#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^((https?):\/\/)?([a-zA-Z0-9_][-_a-zA-Z0-9]{0,62}\.)+([a-zA-Z0-9]{1,20})$"
Local $sString = "xor" & @CRLF & _
"xor.com" & @CRLF & _
"ww2.xor.co" & @CRLF & _
"www.xor.com" & @CRLF & _
"val-id.com" & @CRLF & _
"-invalid.com" & @CRLF & _
"http://xor.com" & @CRLF & _
"https://xour.cu" & @CRLF & _
"www.http://r.com" & @CRLF & _
"https://ww2.xour.cu" & @CRLF & _
"s2._domainkey.lixtil.com.au" & @CRLF & _
"3426127.group27-.hsbspot.co" & @CRLF & _
"hs2._domainkey.lixtil.com.au" & @CRLF & _
"3426127.grou p27-.hu3spot.co" & @CRLF & _
"little_com_au.xor.tinzy.330.net" & @CRLF & _
"3426127.group27.sites.hubseot.net" & @CRLF & _
"littil-com-au.hs01a.dkim.hubspoteeail.net" & @CRLF & _
"sg2.v8143875.c308460036.e.marketingfutomation.services"
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