#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mi)^https?:\/\/((?:[a-z0-9]-?)+[^-\.]\.)?(?:[a-z0-9]-?)+[^-\.]\.[a-z]{2,15}(?:\.[a-z]{2})?$"
Local $sString = "######################## Match" & @CRLF & _
"http://www.example.co.sa" & @CRLF & _
"http://www.some-domain-name.com" & @CRLF & _
"http://WWW.EXAMPLE.NET" & @CRLF & _
"http://www.google.com" & @CRLF & _
"http://www.some-site.engineering" & @CRLF & _
"https://www.google.com" & @CRLF & _
"http://www.efg-cba.asdfgh" & @CRLF & _
"https://some-sub-domain.exam-ple.musem.uk" & @CRLF & _
"http://sub-domain.example-site.engineering" & @CRLF & _
"http://test-www.mi-creativity.com" & @CRLF & _
"https://google.co.in" & @CRLF & _
"http://maps.google.com" & @CRLF & _
"http://abc.site-name.com" & @CRLF & _
"http://google.com" & @CRLF & _
"" & @CRLF & _
"######################## NO Match" & @CRLF & _
"www.google" & @CRLF & _
"www.google.com" & @CRLF & _
"mail.google.com" & @CRLF & _
"://www.google" & @CRLF & _
"//www.google" & @CRLF & _
":google.com" & @CRLF & _
"http://www..google.co.sa" & @CRLF & _
"http://www.google..co.uk" & @CRLF & _
"http://www.google.co..uk" & @CRLF & _
"htt:google.com" & @CRLF & _
"http:google.com" & @CRLF & _
"http:/google.com" & @CRLF & _
"http//www.google.com" & @CRLF & _
"http://www.go ogle.com" & @CRLF & _
"http://www.google.c om" & @CRLF & _
"http://abc.-google.com " & @CRLF & _
"http://efg.g--oogle.com " & @CRLF & _
"http://xyz.google-.com" & @CRLF & _
"http://abc.-google.com" & @CRLF & _
"http://efg.g--oogle.com" & @CRLF & _
"http://cba.example.c" & @CRLF & _
"http://lm.example.co.i" & @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