Skip to content

Instantly share code, notes, and snippets.

@nazt
Forked from anonymous/gist:3448283
Created August 24, 2012 09:41
Show Gist options
  • Select an option

  • Save nazt/3448291 to your computer and use it in GitHub Desktop.

Select an option

Save nazt/3448291 to your computer and use it in GitHub Desktop.
var re, match, html;
re = /<a href="(.*?)">([^<])+<\/a>/g;
re = /<a href=".*?">([^<]+)<\/a>/g;
html = 'Testing <a href="http://yahoo.com">one two three</a> <a href="http://google.com">one two three</a> foo';
while ( ( match = re.exec(html) ) != null )
{
console.log( match );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment