i have this code
preg_match_all('%(?:youtube\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $asd, $match); to find youtube key of urls like
<a href="http://www.youtube.com/watch?v=">http://www.youtube.com/watch?v=ZiJRPREeQ1Q</a> <br /> <a href="http://www.youtube.com/watch?v=GaEZgqxPHLs&feature=related">http://www.youtube.com/watch?v=GaEZgqxPHLs&feature=related</a> this work good to find the code ZiJRPREeQ1Q and GaEZgqxPHLs , now i want to replace all the html line with a new code
wanna to use
preg_replace to find the whole youtube url
<a href="*">*</a> to a new code how can i do that ?
--------------adds--------------
after i get the code of youtube from url by preg_math_all i used this code to extract the codes
foreach($match[1] as $youtube){ // $youtube; // this handle the youtube code $match = ""; // what can i write here relative to $youtube ? $str .= preg_replace($match, 'new code',$content); // $content handle the whole thread that contain the youtube url <a href=*>*</a> } the only thing that i need that what's regular expression that i can use to replace youtube code