PHP preg_replace问题?

hey guys, I'm a preg_replace noob and don't understand how to solve the following case:

$youtubeurl = "((http|https)\:\/\/(www|it|co\.uk|ie|br|pl|jp|fr|es|nl|de)\.youtube\.(com|it|co\.uk|ie|br|pl|jp|fr|es|nl|de)([a-zA-Z0-9\-\.\/\?_=&;]*))"; 
$content = preg_replace($youtubeurl, embedCode($youtubeurl), $content);

I have a pattern that matches any youtube URL. If this pattern is matched i want to call the function embedCode() and pass along the matched string.

How can i do this. right now i'm obviously passing along the regexp code which is of course wrong. I need to pass along the matched string.

thank you

$youtube_url_pattern = "#((http|https)\:\/\/(www|it|co\.uk|ie|br|pl|jp|fr|es|nl|de)\.youtube\.(com|it|co\.uk|ie|br|pl|jp|fr|es|nl|de)([a-zA-Z0-9\-\.\/\?_=&;]*))#"; 

if(preg_match($youtube_url_pattern, $content_containing_url, $content)){
  embedCore($contet[index]);
}

You just have to find the index of matched url, try print_r($content); inside the if and see what is the index for the matched pattern.

You are trying to do this:

if ( preg_match( '/' . $youtubeurl . '/', $content, $match ) )
{
    embedCode( $match );
}