Closed 676339784 closed 2 years ago
hi u asked me to look at this so. to improve your regex u can:
(.*:)//(www.youtube.com/shorts|youtube.com/shorts)(:[0-9]+)?(.*)
.*://(www.)?youtube.com/shorts(:[0-9]+)?(.*)
.*://(www.)?youtube.com/shorts(:[0-9]+)?(.*)
.*:\/\/(www\.)?youtube\.com\/shorts(:[0-9]+)?(.*)
.*
.*:\/\/(www\.)?youtube\.com\/shorts(:[0-9]+)?(.*)
https?:\/\/(www\.)?youtube\.com\/shorts\/([a-zA-Z0-9_]+)
after removing capturing groups that aren't being used, the index in the following line has changed:
additionally, please refrain from using multi-line regexes (as in regex code that spans multiple lines, not regex that matches multiple lines) because taigabot prints all available plugins to the terminal, and multi-line regexes breaks the output making it look ugly (looking at u prushy https://github.com/inexist3nce/Taigabot/commit/f2a1d5dbd2b0985b57d314f9c24d9834880ad64a)
i checked it (using my browser's regex engine) https?:\/\/(www\.)?youtube\.com\/shorts\/([a-zA-Z0-9_]+)
:
the capturing group with the id is 2
.
Right now, the regex doesn't support a non-https link (e.g. www.youtube.com/shorts/P36xIAHDL6w won't match)