#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?im)^(([^<>()\[\]\.,;:\s@\"]{1,64}(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@\[*(?!.*?\.\.)(([^<>()[\]\.,;\s@\"]+\.?)+[^<>()[\]\.,;\s@\"]{2,})\]?"
Local $sString = "prettyandsimple@example.com" & @CRLF & _
"very.common@example.com" & @CRLF & _
"disposable.style.email.with+symbol@example.com" & @CRLF & _
"other.email-with-dash@example.com" & @CRLF & _
"" & @CRLF & _
"(one-letter local part)" & @CRLF & _
"x@example.com" & @CRLF & _
"" & @CRLF & _
""much.more unusual"@example.com" & @CRLF & _
""very.unusual.@.unusual.com"@example.com" & @CRLF & _
""very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com" & @CRLF & _
"example-indeed@strange-example.com" & @CRLF & _
" " & @CRLF & _
"(local domain name with no TLD)" & @CRLF & _
"admin@mailserver1" & @CRLF & _
"" & @CRLF & _
"#!$%&'*+-/=?^_`{}|~@example.org" & @CRLF & _
""()<>[]:,;@\\\"!#$%&'*+-/=?^_`{}| ~.a"@example.org" & @CRLF & _
"" & @CRLF & _
"(space between the quotes)" & @CRLF & _
"" "@example.org" & @CRLF & _
"" & @CRLF & _
"example@localhost" & @CRLF & _
"example@s.solutions" & @CRLF & _
"user@com" & @CRLF & _
"user@localserver" & @CRLF & _
"user@[2001:DB8::1][" & @CRLF & _
"user@[IPv6:2001:db8::1]" & @CRLF & _
"©other.email-with-dash@example.com" & @CRLF & _
"?prettyandsimple@example.com" & @CRLF & _
"用户@例子.广告" & @CRLF & _
"अजअय@डाअटा.भारत" & @CRLF & _
"квіточка@пошта.укр" & @CRLF & _
"θσερ@εχαμπλε.ψομ" & @CRLF & _
"Dörte@Sörensen.example.com" & @CRLF & _
"аджай@экзампл.рус" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"Invalid email addresses[edit]" & @CRLF & _
"" & @CRLF & _
"(no @ character)" & @CRLF & _
"Abc.example.com" & @CRLF & _
"" & @CRLF & _
"(only one @ is allowed outside quotation marks)" & @CRLF & _
"A@b@c@example.com" & @CRLF & _
"" & @CRLF & _
"(none of the special characters in this local part are allowed outside quotation marks)" & @CRLF & _
"a"b(c)d,e:f;g<h>i[j\k]l@example.com" & @CRLF & _
"" & @CRLF & _
"(quoted strings must be dot separated or the only element making up the local part)" & @CRLF & _
"just"not"right@example.com" & @CRLF & _
"" & @CRLF & _
"(spaces, quotes, and backslashes may only exist when within quoted strings and preceded by a backslash)" & @CRLF & _
"this is"not\allowed@example.com" & @CRLF & _
"" & @CRLF & _
"(even if escaped (preceded by a backslash), spaces, quotes, and backslashes must still be contained by quotes)" & @CRLF & _
"this\ still\"not\\allowed@example.com" & @CRLF & _
"" & @CRLF & _
"(double dot before @)" & @CRLF & _
"john..doe@example.com" & @CRLF & _
"with caveat: Gmail lets this through, Email address#Local-part the dots altogether" & @CRLF & _
"" & @CRLF & _
"(double dot after @)" & @CRLF & _
"john.doe@example..com" & @CRLF & _
"" & @CRLF & _
"(exceeds 64 characters in local part)" & @CRLF & _
"1234567890123456789012345678901234567890123456789012345678901234+x@example.com" & @CRLF & _
"alskjnakjanv1wadfqaebbsfdfagfbnbKJANDVlvn13dcljnvzlkjbnadlkgf3cjnj@winnipeg.com" & @CRLF & _
""
Local $sSubst = "QuestionText = "$1","
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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