#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?:[a-z0-9_-]+(?:\.[a-z0-9_-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|" & @CRLF & _
"\\[\x01-\x09\x0b\x0c\x0e-\x7f])*"){2,255}@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9]){1,255}?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9]){1,64}?|" & @CRLF & _
"\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:" & @CRLF & _
"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])"
Local $sString = "valid.email@example.com" & @CRLF & _
"john.doe123@example.co.uk" & @CRLF & _
"alice_smith@company.org" & @CRLF & _
"user1234@emailprovider.net" & @CRLF & _
"test.email1234@email-domain.com" & @CRLF & _
"support@website.info" & @CRLF & _
"jane.doe@emailprovider.org" & @CRLF & _
"contact_us123@example.net" & @CRLF & _
"my.email123@email-provider.co" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"a@ce.ce" & @CRLF & _
"invalid.email@missingtld" & @CRLF & _
"john.doe@invaliddomain.c" & @CRLF & _
"spaces in@email.com" & @CRLF & _
"special!chars@email.com" & @CRLF & _
"noatemail.com" & @CRLF & _
"double..dots@email.com" & @CRLF & _
"@missingusername.com" & @CRLF & _
"user@inva@lid.com" & @CRLF & _
"missingatsigndomain.com"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; 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