php - Get YouTube video id from embed iframe code -


I want to get the YouTube video ID from YouTube embed code using preg_match or regex. For example

  & lt; Iframe width = "560" height = "315" src = "// www.youtube.com/embed/0gugBiEkLwU?rel=0" frameborder = "0" allowfullscreen & gt; & Lt; / Iframe & gt; Can I move the ID  0gugBiEkLwU  

Can someone tell me how to do this? In fact your help is suitable.

Using this method with a capturing group, you should give the string you want: / P >

  d \ / (\ w +) \? Rel = \ d + " 

example:


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -