So I got most of the code working, but what I am trying to do, is say someone post the following
This is a great youtube video http://www.youtube.com/watch?v=pkrM7x0_fcI&feature=channel what do you think.
I want it to turn the youtube link to http://www.youtube.com/v/pkrM7x0_fcI but keep the text that they typed so it should look like this
This is a great youtube video http://www.youtube.com/v/pkrM7x0_fcI what do you think.
If anyone can help that would be great...
if (preg_match_all('#(http://www.youtube.com)?/(v/([-|~_0-9A-Za-z]+)|watch\?v\=([-|~_0-9A-Za-z]+)&?.*?)#i',$youtubeinput,$output))
{
foreach ($output[4] AS $video_id) {
$youtubeinput = "<a class=\"flashvideo\" href=\"http://www.youtube.com/v/".$video_id."\">http://www.youtube.com/v/".$video_id."</a>";
}
}