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 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
   Displaying page 1 of 1 pages; Items 1 to 1

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