Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $regexp="/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[?=&+%\w-]*/i";
- $url="http://youtu.be/NLqAF9hrVbY";
- $result=preg_match($regexp,$url,$matches);
- if ($result)
- {
- echo $matches[0];
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement