#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?<=watch\?v=|/videos/|embed\/|youtu.be\/|\/v\/|\/e\/|watch\?v%3D|watch\?feature=player_embedded&v=|%2Fvideos%2F|embed%2F|youtu.be%2F|%2Fv%2F|shorts\/|live\/)[^#\&\?\n]*"
Local $sString = "https://www.youtube.com/watch?v=dmBbyHx_QKU" & @CRLF & _
"https://www.youtube.com/live/dmBbyHx_QKU?si=3f5yaTBKl0ZW8Kyg" & @CRLF & _
"https://www.youtube.com/embed/dmBbyHx_QKU?si=3f5yaTBKl0ZW8Kyg" & @CRLF & _
"https://www.youtube.com/shorts/Wpzu--so_ts" & @CRLF & _
"https://youtube.com/shorts/Wpzu--so_ts?si=xVSHgPWtOS2uyR9K"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm