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.

2 Responses to “”

  1. Jacob Bøtter Says:

    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.

    =>

  2. Grant Says:

    If there is a space after target this will work (only for double quoted hrefs):


    preg_match('/href="([^"]+)?”/’,$line,$matched);

Leave a Reply