+ 1
ReGex problem for YT Ids catching
Hi, i was looking for a regex that would allow me to get the ids of videos and contents from YouTube, and I found this: https://regex101.com/r/OY96XI/1 However, I noticed that by entering incorrect URL addresses, they were considered as false positives. (The addresses are at the bottom of the page). I also noticed that the last address among the correct ones is not captured. Does anyone know how to correct the error of this regex? I was writing one of my own, then I found this much more effective and complex. Modified regex: https://regex101.com/r/iFiHnt/1
2 ответов
+ 4
Hi,
Test this one:
(?:https?:\/\/)?(?:www\.|m\.)?(?:youtube\.com\/(?:watch\?v=|embed\/|v\/|e\/|user\/.*#p\/u\/\d+\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})
+ 1
Thank you