#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]|[^\x00-\x7F])([A-Za-z0-9@._%+-]|[^\x00-\x7F]){5,253}$)([A-Za-z0-9._%+-]|[^\x00-\x7F]){1,64}@(?:(?=([A-Za-z0-9-]|[^\x00-\x7F]){1,63}\.)([A-Za-z0-9]|[^\x00-\x7F])+(?:-([A-Za-z0-9]|[^\x00-\x7F])+)*\.){1,8}([A-Za-z]|[^\x00-\x7F]){2,63}$"
Local $sString = "Format: minimum 2 characters @ minimum 3 characters . 2 - 63 characters" & @CRLF & _
"" & @CRLF & _
"the g modifier let's us match multiple times in one string. the m modifier is useful here because it lets us treat each line as a seperate entry. Though in practice you probably dont need it for a simple one line email field" & @CRLF & _
"" & @CRLF & _
"^(?=[A-Z0-9][A-Z0-9@._%+-]{5,253}+$)[A-Z0-9._%+-]{1,64}+@(?:(?=[A-Z0-9-]{1,63}+\.)[A-Z0-9]++(?:-[A-Z0-9]++)*+\.){1,8}+[A-Z]{2,63}+$" & @CRLF & _
"" & @CRLF & _
"שדגכ@שדגכ" & @CRLF & _
"" & @CRLF & _
"דגכ" & @CRLF & _
"" & @CRLF & _
"אלפ@גכדץ.בםצ" & @CRLF & _
"" & @CRLF & _
"Jim@stuff.co.uk" & @CRLF & _
"" & @CRLF & _
"Jim@google.com" & @CRLF & _
"" & @CRLF & _
"Henry@h.com" & @CRLF & _
"" & @CRLF & _
"Joe @m.net" & @CRLF & _
"" & @CRLF & _
"Joe@m.net" & @CRLF & _
"" & @CRLF & _
"Joe@mo.net" & @CRLF & _
"" & @CRLF & _
"Joe@sam.net" & @CRLF & _
"" & @CRLF & _
"a@sam.net" & @CRLF & _
"" & @CRLF & _
"mo@sam.org" & @CRLF & _
"" & @CRLF & _
"12@sam.org" & @CRLF & _
"" & @CRLF & _
"Jon@sam.c" & @CRLF & _
"" & @CRLF & _
"Jon@sam.co" & @CRLF & _
"" & @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