#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mi)^(?!.*\.{2})(?!\.)[a-z0-9_.'-]*[a-z0-9_'-]@(?!_)(?:[a-z0-9_'-]+\.)+[a-z0-9_'-]{2,}$"
Local $sString = "ya.ll.t.j@gg.cc" & @CRLF & _
"ya..l.f@dd.cc" & @CRLF & _
"y.s.sss...@kk.dd" & @CRLF & _
"" & @CRLF & _
"allowed: uppercase and lowercase English letters, digits 0 to 9" & @CRLF & _
"" & @CRLF & _
"allowed: "_", "-", “.”, “@” and "'";" & @CRLF & _
"" & @CRLF & _
"3.a. Character "." is allowed to be provided if it is not the first or last character" & @CRLF & _
"a.b@def.com" & @CRLF & _
".b@def.com" & @CRLF & _
"a.@def.com" & @CRLF & _
"" & @CRLF & _
"3.b. "." does not appear two or more times consecutively" & @CRLF & _
"a..b@def.com" & @CRLF & _
"a.b@def..com" & @CRLF & _
"" & @CRLF & _
"3.c. "." must appear at least one time in domain name" & @CRLF & _
"a.b@defcom" & @CRLF & _
"" & @CRLF & _
"should not contain “.@” or “@.”" & @CRLF & _
"a.b@.def.com" & @CRLF & _
"a.b.@def.com" & @CRLF & _
"" & @CRLF & _
"In the domain name, the string length, after last “.” , should have at least 2 characters" & @CRLF & _
"a.b@def.c" & @CRLF & _
"" & @CRLF & _
"Leading "_" is not allowed in the domain name" & @CRLF & _
"a.b@_def.com"
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