Skip to content

Instantly share code, notes, and snippets.

@skarankevich
Last active March 27, 2018 06:44
Show Gist options
  • Save skarankevich/24e119211cd55930a4c66075af17342e to your computer and use it in GitHub Desktop.
Save skarankevich/24e119211cd55930a4c66075af17342e to your computer and use it in GitHub Desktop.
RegExp for Video ID from YouTube links
https?:\/\/(?:www.)?youtu(?:.be|be.com)\/(?:.+?v=|)([a-zA-Z0-9_-]{11})/
Works with:
https://www.youtube.com/watch?v=6QjIHnb5Ivs
https://youtu.be/6QjIHnb5Ivs?t=37
https://www.youtube.com/watch?v=6QjIHnb5Ivs&feature=youtu.be#t=37
https://youtu.be/6QjIHnb5Ivs
http://youtu.be/6QjIHnb5Ivs?t=37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment