#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^s*((https?:\/\/)((\S+\.+\S+)|(\[?(\S+:)+\S+\]?)|({.*}.*))?(?::\d+)?({.*}.*)?|({.*}.*))\s*$" & @CRLF & _
""
Local $sString = "http://foo.bar" & @CRLF & _
"https://foo.bar" & @CRLF & _
"https://foo.bar/{foo}" & @CRLF & _
"{foo}" & @CRLF & _
"" & @CRLF & _
"IPv4" & @CRLF & _
"http://foo123.bar/{Fave Country (South Africa):3.1}" & @CRLF & _
"https://foo123.bar/{field :1}" & @CRLF & _
"https://{field:1}" & @CRLF & _
"https://foo.bar/{field:1}/" & @CRLF & _
"https://foo.bar/{field:1}:8080?name=value#fragment" & @CRLF & _
"http://foo.bar" & @CRLF & _
"https://foo.bar/path/to/resource" & @CRLF & _
"http://192.168.0.1:8080/path/to/file/?name=value" & @CRLF & _
"https://[2001:db8::1]:443/resource" & @CRLF & _
"" & @CRLF & _
"Starting with merge tag" & @CRLF & _
"{field:1}" & @CRLF & _
"{field:1}/path/to?name=value#fragment" & @CRLF & _
"" & @CRLF & _
"IPv6" & @CRLF & _
"https://2001:0db8:85a3:0000:0000:8a2e:0370:7334" & @CRLF & _
"https://001:db8:85a3::8a2e:370:7334" & @CRLF & _
"https://::1" & @CRLF & _
"https://::ffff:192.0.2.128" & @CRLF & _
"https://[fe80::1%25eth0]/{field :1}" & @CRLF & _
"https://fe80::1%eth0" & @CRLF & _
"https://ff02::1" & @CRLF & _
"https://2001:4860:4860::8888" & @CRLF & _
"https://2001:db8::2:1" & @CRLF & _
"https://fd12:3456:789a:1::1" & @CRLF & _
"https://1234:5678:90ab:cdef::1" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"NON VALID:" & @CRLF & _
"htp://foo.bar" & @CRLF & _
"//foo.bar" & @CRLF & _
"dfdf{field:1}" & @CRLF & _
"http://foo" & @CRLF & _
"foo" & @CRLF & _
"https//foo" & @CRLF & _
"https://foodfdf" & @CRLF & _
"htp://foo.bar" & @CRLF & _
"foo.bar" & @CRLF & _
"http://foo" & @CRLF & _
"foo.bar/{field:1}" & @CRLF & _
"" & @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