Skip to content

Instantly share code, notes, and snippets.

@exside
Forked from FinalAngel/get_youtube_id_regex.js
Created October 10, 2018 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exside/5a7e5242f10afa57d4df6c92eb9f587e to your computer and use it in GitHub Desktop.
Save exside/5a7e5242f10afa57d4df6c92eb9f587e to your computer and use it in GitHub Desktop.
get youtube id regex
/(youtu(?:\.be|be\.com)\/(?:.*v(?:\/|=)|(?:.*\/)?)([\w'-]+))/i
Tested examples:
http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo
http://www.youtube.com/watch?v=cKZDdG9FTKY&feature=channel
http://www.youtube.com/watch?v=yZ-K7nCVnBI&playnext_from=TL&videos=osPknwzXEas&feature=sub
http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I
http://www.youtube.com/user/SilkRoadTheatre#p/a/u/2/6dwqZw0j_jY
http://youtu.be/6dwqZw0j_jY
http://www.youtube.com/watch?v=6dwqZw0j_jY&feature=youtu.be
http://youtu.be/afa-5HQHiAs
http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo?rel=0
http://www.youtube.com/watch?v=cKZDdG9FTKY&feature=channel
http://www.youtube.com/watch?v=yZ-K7nCVnBI&playnext_from=TL&videos=osPknwzXEas&feature=sub
http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I
http://www.youtube.com/embed/nas1rJpm7wY?rel=0
http://www.youtube.com/watch?v=peFZbP64dsU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment