#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?<=https?://)(?:\w+\.)+(?<domain>\w+\.\w+)[/\s$]"
Local $sString = "https://www.subdomain.example.com/folder/folder" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"valid.domains.below" & @CRLF & _
"schools.k12 " & @CRLF & _
"newTLD.clothing text thtat should not be matched " & @CRLF & _
"good.photography" & @CRLF & _
"x.a-b.com" & @CRLF & _
"x-y.a-b.net" & @CRLF & _
"x-y.a-b-c.co.uk" & @CRLF & _
"x.0ac.com" & @CRLF & _
"schools.k12" & @CRLF & _
"newTLD.clothing" & @CRLF & _
"good.photography" & @CRLF & _
"0-1-2.3-4.co" & @CRLF & _
"a-----b.com" & @CRLF & _
"" & @CRLF & _
"hello he.llo-o.com/okayokay/" & @CRLF & _
"" & @CRLF & _
"https://www.11737.se/hello/" & @CRLF & _
"" & @CRLF & _
"http://www.11377.se/hello/" & @CRLF & _
"" & @CRLF & _
"www.11773.se/hello/" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"invalid-.domains for fun" & @CRLF & _
"-domain.com" & @CRLF & _
"domain--.com" & @CRLF & _
"-domain-.-.com" & @CRLF & _
"domain.000" & @CRLF & _
".domain.net" & @CRLF & _
"domain.net." & @CRLF & _
"sub.-domain.com" & @CRLF & _
"sub.domain-.com" & @CRLF & _
"sub-.domain.com" & @CRLF & _
"-sub.domain.com" & @CRLF & _
"" & @CRLF & _
""
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