#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?im)^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\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 & _
"x@example.com (one-letter local part)" & @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 & _
"admin@mailserver1 (local domain name with no TLD)" & @CRLF & _
"#!$%&'*+-/=?^_`{}|~@example.org" & @CRLF & _
""()<>[]:,;@\\\"!#$%&'*+-/=?^_`{}| ~.a"@example.org" & @CRLF & _
"" "@example.org (space between the quotes)" & @CRLF & _
"example@localhost (sent from localhost)" & @CRLF & _
"example@s.solutions (see the List of Internet top-level domains)" & @CRLF & _
"user@com" & @CRLF & _
"user@localserver" & @CRLF & _
"user@[IPv6:2001:db8::1]" & @CRLF & _
"©other.email-with-dash@example.com" & @CRLF & _
"?prettyandsimple@example.com" & @CRLF & _
"" & @CRLF & _
"Invalid email addresses[edit]" & @CRLF & _
"Abc.example.com (no @ character)" & @CRLF & _
"A@b@c@example.com (only one @ is allowed outside quotation marks)" & @CRLF & _
"a"b(c)d,e:f;g<h>i[j\k]l@example.com (none of the special characters in this local part are allowed outside quotation marks)" & @CRLF & _
"just"not"right@example.com (quoted strings must be dot separated or the only element making up the local part)" & @CRLF & _
"this is"not\allowed@example.com (spaces, quotes, and backslashes may only exist when within quoted strings and preceded by a backslash)" & @CRLF & _
"this\ still\"not\\allowed@example.com (even if escaped (preceded by a backslash), spaces, quotes, and backslashes must still be contained by quotes)" & @CRLF & _
"john..doe@example.com (double dot before @)" & @CRLF & _
"with caveat: Gmail lets this through, Email address#Local-part the dots altogether" & @CRLF & _
"john.doe@example..com (double dot after @)"
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