Regex for YouTube ID [duplicate]

This is a duplicate question, and has been answered before.

I think you will find the regexp there will also work here.

parse youtube video id using preg_match

EDIT:
I noticed that it does not work for the sandalsResort URL you have at the top of your list, so you can modify the regex to the following (converted for use in JS)

var myregexp = /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/gi;

All I did was to replace user with [^/]+

The ID is still captured in back-reference 1.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)