Last active
May 21, 2020 20:40
-
-
Save tobiaswx/3c6707911ea716860786728d31f8e3e5 to your computer and use it in GitHub Desktop.
Regex | Regular Expression to identify YouTube-URLs with video-id match
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://regex101.com/r/l0m7yh/3 | |
Regex: ^(https?\:\/\/)?(www\.)?(youtube\.com|youtu\.?be)(\/)?(embed\/)?(watch\?v=|\?v=)?(?<video_id>.*)$ | |
Group 7 / 'video_id' includes the video-id | |
Testes with examples like: | |
https://www.youtube.com/watch?v=osz5tVY97dQ | |
https://youtube.com/watch?v=osz5tVY97dQ | |
https://youtube.com/osz5tVY97dQ | |
youtube.com/watch?v=osz5tVY97dQ | |
https://www.youtu.be/watch?v=osz5tVY97dQ | |
https://youtu.be/watch?v=osz5tVY97dQ | |
https://youtu.be/?v=osz5tVY97dQ | |
https://youtu.be/osz5tVY97dQ | |
youtu.be/osz5tVY97dQ | |
https://www.youtube.com/embed/osz5tVY97dQ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update 21.05.2020: