$re = '/(https?:\/\/)?(www.)?((player.vimeo.com\/video\/[0-9]{9})|((youtube.com|youtu\.be)\/embed\/([\w-]{9,11})))/m';
$str = 'http://www.youtube.com/watch?v=GKnQGP67Xd0
https://www.youtube.com/watch?v=GKnQGP67Xd0
https://www.youtube.com/watch?v=GKnQGP67Xd0
https://www.youtube.com/watch?v=GKnQGP67Xd0
https://vimeo.com/662065137
https://vimeo.com/662065137
https://www.youtube.com/c/riotgamesmusic
https://vimeo.com/662065137
https://youtu.be/aXUCHNaZkWo
https://vimeo.com/662065137
https://vimeo.com/baconbaconbacon
https://www.youtube.com/channel/UCG_wKjFPEpdHf1Q6bTdE2JA
https://player.vimeo.com/video/662065137
última formato corto: http://youtu.be/NLqAF9hrVbY
iframe: http://www.youtube.com/embed/NLqAF9hrVbY
iframe (seguro): https://www.youtube.com/embed/NLqAF9hrVbY
objeto param: http://www.youtube.com/v/NLqAF9hrVbY?fs=1&hl=en_US
objeto de incrustación: http://www.youtube.com/v/NLqAF9hrVbY?fs=1&hl=en_US
ver: http://www.youtube.com/watch?v=NLqAF9hrVbY
usuarios: http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo
ytscreeningroom: http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I
cualquier cosa vale!: http://www.youtube.com/sandalsResorts#p/c/54B8C800269D7C1B/2/PPS-8DMrAn4
cualquier/subdominio/: http://gdata.youtube.com/feeds/api/videos/NLqAF9hrVbY
más params: http://www.youtube.com/watch?v=spDj54kf-vY&feature=g-vrec
la consulta puede tener el punto: http://www.youtube.com/watch?v=spDj54kf-vY&feature=youtu.be';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php