I'm trying to isolate a youtube video ID from either the embedded link or actual URL link.
Embedded link looks like:
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/JdxkVQy7QLM&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/JdxkVQy7QLM&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>
Actual links looks like:
http://youtube.com/watch?v=JdxkVQy7QLM
http://www.youtube.com/watch?v=JdxkVQy7QLM
www.youtube.com/watch?v=JdxkVQy7QLM
etc.
I found this for the embedded link:
if(preg_match('/youtube\.com\/v\/([\w\-]+)/', $_POST['youtube'], $match)) {;
echo $match[1];
}
But I can't figure out the actual links. Also, if anyone know a good pattern syntax tutorial that would be great too because I'm bad at that.