I am looking for a piece of PHP code that returns URL’s found in piece of text. I need it to recognize the urls in the following example (found in an RSS feed), which my current code can’t handle.
<a href="http://www.michaelverdi.com/video/watermark.mov"target="_blank"><img src="http://www.michaelverdi.com/images/watermark.jpg" border="0" /></a>
<br />That's right, I spent all weekend at my computer for your viewing pleasure.
December 11th, 2004 at 7:16 pm
Isn’t your problem that the above HTML is wrong? First off, target shouldn’t be used anymore and second you need a space between the ending href and the starting target.
=>
December 12th, 2004 at 11:36 am
If there is a space after target this will work (only for double quoted hrefs):
preg_match('/href="([^"]+)?”/’,$line,$matched);