I am trying to write a regex to get the string between v=
and &t
so in the case below I would get 1oDaF770-ws
// I want to get 1oDaF770-ws from the url below
const url = "https://www.youtube.com/watch?v=1oDaF770-ws&t=67s"
I have the following code
const url = "https://www.youtube.com/watch?v=1oDaF770-ws&t=67s"
url.match(/(?<=v=\s*).*?(?=\s*&t=)/gs);
As you can see I have followed the answer here but unfortunately it doesn't seem to work for me.