I'm trying to use regex in order to retrieve youtube video ID (embedded)
Assuming the following urls:
http://www.youtube.com/embed/f0Cn2g8ekMQ/
http://www.youtube.com/embed/f0Cn2g8ekMQ//
http://www.youtube.com/embed/f0Cn2g8ekMQ?param
I'd like to get the ID "f0Cn2g8ekMQ".
I was trying to do it this way:
regex: https?://www\.youtube\.com/embed/(\S+)[/|\?]?.*
But it seems like the or operator doesn't work for me and the ID I recieve include the "/" or "?" and the rest of the string.
Is there any good way to do it with regex?
Thanks!