Skip to content

Instantly share code, notes, and snippets.

@Boztown
Created December 20, 2013 20:29
Show Gist options
  • Select an option

  • Save Boztown/8060963 to your computer and use it in GitHub Desktop.

Select an option

Save Boztown/8060963 to your computer and use it in GitHub Desktop.
C# Get YouTube ID from URL.
(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^""&?\/ ]{11})
Regex.Match(url, @"(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^""&?\/ ]{11})").Groups[1].Value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment