Advertisement
Fuzzysteve

Untitled

May 27th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. <?
  2.  
  3. $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";
  4. $url="http://youtu.be/NLqAF9hrVbY";
  5.  
  6. $result=preg_match($regexp,$url,$matches);
  7.  
  8. if ($result)
  9. {
  10. echo $matches[0];
  11. }
  12.  
  13.  
  14.  
  15. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement