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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Extract Youtube Video ID
Expression
(?:youtu\.be\/|youtube.com\/(?:watch\?.*\bv=|embed\/|v\/)|ytimg\.com\/vi\/)(.+?)(?:[^-a-zA-Z0-9]|$)
Description
This regex should recognize a Youtube video ID from any Youtube URL, embed snippet, or preview image.
Matches
http://www.youtube.com/watch?v=QH2-TGUlwu4 | http://youtu.be/QH2-TGUlwu4 | http://www.youtube.com/embed/QH2-TGUlwu4 | http://www.youtube.com/v/QH2-TGUlwu4?version=3&hl=en_US | http://i4.ytimg.com/vi/QH2-TGUlwu4/default.jpg
Non-Matches
asdf
Author Rating: Not yet rated. Robert Rothermel
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

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