JSFiddle - React, Tailwind, and code Playground

JavaScript

var youtubePattern = /https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[?=&+%\w-]*/ig;

var exmpleYouTubeURLs = [
        "http://youtu.be/NLqAF9hrVbY",
        "http://www.youtube.com/embed/NLqAF9hrVbY",
        "https://www.youtube.com/embed/NLqAF9hrVbY",
        "http://www.youtube.com/v/NLqAF9hrVbY?fs=1&hl=en_US",
        "http://www.youtube.com/watch?v=NLqAF9hrVbY",
        "http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo",
        "http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I",
        "http://www.youtube.com/sandalsResorts#p/c/54B8C800269D7C1B/2/PPS-8DMrAn4",
        "http://gdata.youtube.com/feeds/api/videos/NLqAF9hrVbY",
        "http://www.youtube.com/watch?v=spDj54kf-vY&feature=g-vrec",
        "http://www.youtube.com/watch?v=GUEZCxBcM78&feature=pyv&feature=pyv&ad=10059374899&kw=%2Bwingsuit"
    ];

// Extract the YouTube ID 
function linkifyYouTubeURLs(text) {
    return text.replace(youtubePattern, '$1');
}

for(i=0; i < exmpleYouTubeURLs.length; i++) {
    document.writeln(i + ". " + linkifyYouTubeURLs(exmpleYouTubeURLs[i]) + "<br>");
}