this is the code I am trying :
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.";
while (match = /youtube\.com\/watch\?v=([^\s]+)/.exec(str)) {
arr.push(match[1]);
}
console.log(arr);
it should capture the last part of the url's and push them to an array.
the array I am expecting is :
["123456", "3t_3456"]
but this code is going in an infinite loop, what's wrong with it ?