#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^[-a-zA-Z0-9#$%'_]+(\.[-a-zA-Z0-9#$%'_]+)*@(([a-zA-Z0-9]{1,2}|[a-zA-Z0-9][-a-zA-Z0-9]+[a-zA-Z0-9])\.)+(?!\d+$)[a-zA-Z0-9]{2,4}$"
Local $sString = "Aba@example.com" & @CRLF & _
"test@test-test.com.com" & @CRLF & _
"test.abc-efg'@test-test.com.com.01111co" & @CRLF & _
"simple@example.com" & @CRLF & _
"very.common@example.com" & @CRLF & _
"other.email-with-hyphen@example.com" & @CRLF & _
"fully-qualified-domain@example.com" & @CRLF & _
"example-indeed@strange-example.com" & @CRLF & _
"example@s.example" & @CRLF & _
"" & @CRLF & _
"Abc.example.com" & @CRLF & _
"A@b@c@example.com" & @CRLF & _
"just"not"right@example.com" & @CRLF & _
"this is"not\allowed@example.com" & @CRLF & _
"1234567890123456789012345678901234567890123456789012345678901234+x@example.com" & @CRLF & _
"john..doe@example.com" & @CRLF & _
"john.doe@example..com" & @CRLF & _
"" & @CRLF & _
"test@-test.com" & @CRLF & _
""
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