#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?!-)(xn--)?[a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9]{0,1}\.(?!-)(xn--)?([a-zA-Z0-9\-]{1,50}|[a-zA-Z0-9-]{1,30}\.[a-zA-Z]{2,})$"
Local $sString = "#Valid" & @CRLF & _
"xn-fsqu00a.xn-0zwm56d" & @CRLF & _
"xn-fsqu00a.xn--vermgensberatung-pwb" & @CRLF & _
"xn--stackoverflow.com" & @CRLF & _
"stackoverflow.xn--com" & @CRLF & _
"stackoverflow.co.uk" & @CRLF & _
"google.com.au" & @CRLF & _
"i.oh1.me" & @CRLF & _
"wow.british-library.uk" & @CRLF & _
"xn--stackoverflow.com" & @CRLF & _
"stackoverflow.xn--com" & @CRLF & _
"stackoverflow.co.uk" & @CRLF & _
"0-0O_.COM" & @CRLF & _
"a.net" & @CRLF & _
"0-0O.COM" & @CRLF & _
"0-OZ.CO.uk" & @CRLF & _
"0-TENSION.COM.br" & @CRLF & _
"0-WH-AO14-0.COM-com.net" & @CRLF & _
"a-1234567890-1234567890-1234567890-1234567890-1234567890-1234-z.eu.us" & @CRLF & _
"#Invalid" & @CRLF & _
"-0-0O.COM" & @CRLF & _
"0-0O.-COM" & @CRLF & _
"-a.dot" & @CRLF & _
"a-1234567890-1234567890-1234567890-1234567890-1234567890-12345-z.eu.us"
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