JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="input" />http://www.youtube.com/watch?v=iol0B-clFFM

JavaScript

$(document).ready(function () {
    var textval = $('#input');
    var youtube = /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i;

    var pasting = false;
    
    $("#input").bind('paste', function () {
        pasting = true;
    });
    
    $("#input").bind('propertychange input', function () {
        if(!pasting) {
            return;
        }
        pasting = false;
        
        if (youtube.test(textval.val())) {
            var yurl = textval.val().match(youtube)[0];
            alert(yurl);
        }
    });
});