RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details YouTube Video Link Verifier + ID puller
Expression
(?:[hH][tT]{2}[pP][sS]{0,1}:\/\/)?[wW]{0,3}\.{0,1}[yY][oO][uU][tT][uU](?:\.[bB][eE]|[bB][eE]\.[cC][oO][mM])?\/(?:(?:[wW][aA][tT][cC][hH])?(?:\/)?\?(?:.*)?[vV]=([a-zA-Z0-9--]+).*|([A-Za-z0-9--]+))
Description
Verifies YouTube video links AND pulls the video ID from them in a matching group. Works with all capitalizations. It also matches the WHOLE link but sorts the video ID into a group. Works with JavaScript, PHP and Python. (Not tested with any other Regex engine) WARNING: youtu.be links have their ID group as the second group.
Matches
http://www.youtube.com/watch?v=something | https://www.youtube.com/watch?v=something | http://youtu.BE/something | https://www.YOUTUBE.com/watch?en=gb&vari=abc&v=something&another=yes
Non-Matches
http://www.anothersite.com/watch?v=something | http://www.youtube.com/wat?v=something
Author Rating: The rating for this expression. Billy Venner
   Displaying page 1 of 1 pages; Items 1 to 1

Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials