Skip to content

Instantly share code, notes, and snippets.

@nowri
Created July 12, 2012 11:00
Show Gist options
  • Save nowri/3097430 to your computer and use it in GitHub Desktop.
Save nowri/3097430 to your computer and use it in GitHub Desktop.
YoutubeのURLからIDのみ抜き出す
preg_replace('/.*v=([\d\w]+).*/', '$1', 'http://www.youtube.com/watch?v=1O6aOHb4Zv0')
var str:String = "http://www.youtube.com/user/example/Custom";
var exp:RegExp = /\/user\/(.+)\/ /x;
trace(exp.exec(str)[1]);//"example"
/[/?=]([-\w]{11})/.exec(url)[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment