%
#
# Inspired by http://stackoverflow.com/questions/6556559/youtube-api-extract-video-id
# Example: https://www.youtube.com/watch?v=o8QuLYXKNCg&rel=0&autoplay=1
#
# Match any youtube URL
(?:https?://)? # Optional scheme. Either http or https
(?:www\.)? # Optional www subdomain
(?: # Group host alternatives
youtu\.be/ # Either youtu.be,
| youtube\.com # or youtube.com
(?: # Group path alternatives
/embed/ # Either /embed/
| /v/ # or /v/