1

So , I need to grab the first youtube link from a page , and if I do so :

preg_match('/<a.*?href="http:\/\/www\.youtube\.com\/watch\?v=.*?".*?>.*?<\/a>/ms', $html, $rez);

It will grab me everything that starts with a <a and ends with a href to youtube , so how cand I do to grab only the

<a (ANYTHING) href="http://www.youtube.com/watch?=..." (ANYTHING) >(ANYTHING)</a> ?

  • 1
    http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454, you're headed down a slippery slope with HTML and Regex. – Mike Perrenoud May 25 '13 at 08:16

0 Answers0