#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?i)<a\s*href="(?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:.*v=|v\/|watch\/|)([-\w]+)[^"]*"[^>]*>"
Local $sString = "<a href="http://www.youtube.com/watch?v=iwGFalTRHDA"></a>" & @CRLF & _
"<a href="https://www.youtube.com/watch?v=iwGFalTRHDA"></a>" & @CRLF & _
"<a href="http://www.youtube.com/watch?v=iwGFalTRHDA&feature=related"></a>" & @CRLF & _
"<a href="http://youtu.be/iwGFalTRHDA"></a>" & @CRLF & _
"<a href="http://www.youtube.com/embed/watch?feature=player_embedded&v=iwGFalTRHDA"></a>" & @CRLF & _
"<a href="http://www.youtube.com/embed/watch?v=iwGFalTRHDA"></a>" & @CRLF & _
"<a href="http://www.youtube.com/embed/v=iwGFalTRHDA"></a>" & @CRLF & _
"<a href="http://www.youtube.com/watch?feature=player_embedded&v=iwGFalTRHDA"></a>" & @CRLF & _
"<a href="http://www.youtube.com/watch?v=iwGFalTRHDA"></a>" & @CRLF & _
"<a href="www.youtube.com/watch?v=iwGFalTRHDA"></a>" & @CRLF & _
"<a href="www.youtu.be/iwGFalTRHDA"></a>" & @CRLF & _
"<a href="youtu.be/iwGFalTRHDA"></a>" & @CRLF & _
"<a href="youtube.com/watch?v=iwGFalTRHDA"></a>" & @CRLF & _
"<a href="http://www.youtube.com/watch/iwGFalTRHDA"></a>" & @CRLF & _
"<a href="http://www.youtube.com/v/iwGFalTRHDA"></a>" & @CRLF & _
"<a href="http://www.youtube.com/v/i_GFalTRHDA"></a>" & @CRLF & _
"<a href="http://www.youtube.com/watch?v=i-GFalTRHDA&feature=related"></a>" & @CRLF & _
"<a href="http://www.youtube.com/attribution_link?u=/watch?v=aGmiw_rrNxk&feature=share&a=9QlmP1yvjcllp0h3l0NwuA"></a>" & @CRLF & _
"<a href="http://www.youtube.com/attribution_link?a=fF1CWYwxCQ4&u=/watch?v=qYr8opTPSaQ&feature=em-uploademail"></a>" & @CRLF & _
"<a href="http://www.youtube.com/attribution_link?a=fF1CWYwxCQ4&feature=em-uploademail&u=/watch?v=qYr8opTPSaQ"></a>"
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