Вот твоя регулярка
CODE:$string = preg_replace_callback('#\[youtube(=(.+?)|)\].+?youtube.com/watch\?v=(.+?)(&.+?|)\[/youtube\]#is', array($this, 'youtube'), $string);
и вот вой обработчик на ютуб
CODE:function youtube($matches) {
$title = ($matches[2] !== '') ? '<b>'.$matches[2].'</b><br>' : '';
return $title.'<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/'.$matches[3].'&hl=ru&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'.$matches[3].'&hl=ru&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br>';
} |