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 ID
Expression
(?:[Yy][Oo][Uu][Tt][Uu][Bb][Ee]\.[Cc][Oo][Mm]/watch\?v=)([\w-]{11})
Description
.NET 3.5 Tested. Used to extract the YouTubeID from a fully qualified YouTube URL. Dim _Regex As New Regex("(?:[Yy][Oo][Uu][Tt][Uu][Bb][Ee]\.[Cc][Oo][Mm]/watch\?v=)([\w-]{11})", RegexOptions.IgnoreCase Or RegexOptions.Compiled) Dim _RegexMatch As Match = _Regex.Match("http://www.youtube.com/watch?v=pW2GSdxxwDg") Dim _YouTubeVideoID As System.String = _RegexMatch.Groups(1).Value
Matches
http://www.youtube.com/watch?v=pW2GSdxxwDg | http://www.youtube.com/watch?v=-7P7_kxZQ5I | http://www.youtube.com/watch?v=7sPKHwsupmQ&playnext=1&list=PL40CB7986D1A9A285 | http://www.youtube.com/watch?v=r-di4gJvq4Q&feature=channel_video_title
Non-Matches
http://www.youtu.be/watch?v=pW2GSdxxwDg
Author Rating: The rating for this expression. Charlie Seitz
   Displaying page 1 of 1 pages; Items 1 to 1

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