JSFiddle - React, Tailwind, and code Playground

JavaScript

var arr = [];
var str = "hey check this video out! youtube.com/watch?v=123456 and there is some other text youtube.com/watch?v=3t_3456 and some more.";
var re = /youtube\.com\/watch\?v=([^\s]+)/;
while (match = re.exec(str)) {
  arr.push(match[1]);
}
console.log(arr);