I want to match some links from a web content. I know I can use file_get_contents(url) to do this in php. How about in javascript?
For regular expression, like
<a href="someurl/something" id="someid">contents</a>
How can I use js regular expression to match this (match only once, do not greedy). I try to use this
/^\<a href=\"someurl\/something\" id=\"someid\"\>(+?)\<\/a\>$/
but it doesn’t work.
Can someone help?
Thanks!
DOM and jQuery suggestions are better but if you still want to use regex then try this: