#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?i)(?:[a-z0-9+!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?: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]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])"
Local $sString = "[a-zA-Z0-9-_.+]+@[a-zA-Z0-9-_.]+" & @CRLF & _
"" & @CRLF & _
"ekoprasetyo.crb@outlook.com" & @CRLF & _
"db.maulana@gmail.com." & @CRLF & _
" dee.wien@yahoo.com. ." & @CRLF & _
""deninainggolan@yahoo.co.id" " & @CRLF & _
"Fajar.rohita@hotmail.com klaas knot (firmansya1404@gmail.aero); " & @CRLF & _
"dydmm, sss <fransisca+jw@gmail.com>, donny_tri_wardono@yahoo.co.id thank a" & @CRLF & _
""Helpdesk | Energiem**ine" <helpdesk@ene---ine.nl>" & @CRLF & _
"invalid: John..Doe@example.com " & @CRLF & _
"valid: John.Doe@example.com" & @CRLF & _
"" & @CRLF & _
"Valid addresses from https://en.wikipedia.org/wiki/Email_address" & @CRLF & _
"simple@example.com" & @CRLF & _
"very.common@example.com" & @CRLF & _
"FirstName.LastName@EasierReading.org" & @CRLF & _
"x@example.com" & @CRLF & _
"long.email-address-with-hyphens@and.subdomains.example.com" & @CRLF & _
"user.name+tag+sorting@example.com" & @CRLF & _
"name/surname@example.com" & @CRLF & _
"admin@example" & @CRLF & _
"example@s.example" & @CRLF & _
"" "@example.org" & @CRLF & _
""john..doe"@example.org" & @CRLF & _
"mailhost!username@example.org" & @CRLF & _
""very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com" & @CRLF & _
"user%example.com@example.org" & @CRLF & _
"user-@example.org" & @CRLF & _
"postmaster@[123.123.123.123]" & @CRLF & _
"postmaster@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:7334]" & @CRLF & _
"_test@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:7334]"
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