The below regex clears the 77 links you provided.*
(http:\/\/|https:\/\/)?(((www.)?youtu.be\/)|(www.|m.)?youtube.com\/((embed\/|shorts\/)|(\?|(watch\?(dev=inprogress&)?)?)?vi?(\/|=)))(([0-9a-zA-Z_-])+)([$=#&?\/'"\s])(t=([0-9]+(:[0-9](2))*)*)?
It will capture the <video-id>
and <start-time>
. Start time can be an integer, or an integer followed by a colon followed by a 2-digit-integer followed by colon followed by 2-digit integer..., e.g. t=2055577:33:44:00
In PHP**, you can id/capture the group pattern, in this case the and patterns, by adding ?<video-id>
and ?<start-time>
immediately after the opening parenthesis "(
" of the capturing parenthesis like this(*): (?<video-id>([0-9a-zA-Z_-])+)
and (?<start-time>t=([0-9]+(:[0-9](2))*)*)?
Here is the update regex for PHP with the <video-id>
and <start-time>
group identifiers:
(http:\/\/|https:\/\/)?(((www.)?youtu.be\/)|(www.|m.)?youtube.com\/((embed\/|shorts\/)|(\?|(watch\?(dev=inprogress&)?)?)?vi?(\/|=)))(?<video-id>([0-9a-zA-Z_-])+)([$=#&?\/'"\s])(?<start-time>t=([0-9]+(:[0-9](2))*)*)?
* Regex pattern tested at https://regex101.com/ for PHP>=7.3
** Regex Capturing Groups for PHP at * https://www.phptutorial.net/php-tutorial/regex-capturing-groups/,