#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?xm)" & @CRLF & _
"# allow multiple groups with the same name" & @CRLF & _
"(?J)" & @CRLF & _
"# protocol user host-ip port path path path querystring fragment" & @CRLF & _
"^" & @CRLF & _
"#protocol" & @CRLF & _
"(?:(?<scheme>[a-zA-Z][a-zA-Z\d+-.]*):)?" & @CRLF & _
"(?|" & @CRLF & _
" #slash-slash" & @CRLF & _
" \/\/" & @CRLF & _
" #userinfo" & @CRLF & _
" (?:" & @CRLF & _
" #user" & @CRLF & _
" (?<user>[a-zA-Z\d\-._~\!$&'()*+,;=%]*)" & @CRLF & _
" #password" & @CRLF & _
" (?::(?<pass>[a-zA-Z\d\-._~\!$&'()*+,;=:%]*))?" & @CRLF & _
" @)?" & @CRLF & _
" #host-ip" & @CRLF & _
" (?<host>(?:[a-zA-Z\d-.%]+)|(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(?:\[(?:[a-fA-F\d.:]+)\]))?" & @CRLF & _
" #port" & @CRLF & _
" (?::(?<port>\d*))?" & @CRLF & _
" #slash-path" & @CRLF & _
" (?<path>" & @CRLF & _
" (?:\/ [a-zA-Z\d\-._~\!$&'()*+,;=:@%]* )*" & @CRLF & _
" )" & @CRLF & _
"" & @CRLF & _
" #slash-path" & @CRLF & _
" |(?<user>)(?<pass>)(?<host>)(?<port>)" & @CRLF & _
" (?<path>\/ [a-zA-Z\d\-._~\!$&'()*+,;=:@%]+(?:\/[a-zA-Z\d\-._~\!$&'()*+,;=:@%]*)*)?" & @CRLF & _
"" & @CRLF & _
" #path" & @CRLF & _
" |(?<user>)(?<pass>)(?<host>)(?<port>)" & @CRLF & _
" (?<path> [a-zA-Z\d\-._~\!$&'()*+,;=:@%]+(?:\/[a-zA-Z\d\-._~\!$&'()*+,;=:@%]*)*)" & @CRLF & _
"" & @CRLF & _
")?" & @CRLF & _
"#querystring" & @CRLF & _
"(?:\?(?<query>[a-zA-Z\d\-._~\!$&'()*+,;=:@%\/?]*))?" & @CRLF & _
"#fragment" & @CRLF & _
"(?:\#(?<fragment>[a-zA-Z\d\-._~\!$&'()*+,;=:@%\/?]*))?" & @CRLF & _
"$" & @CRLF & _
""
Local $sString = "https://regex101.com/" & @CRLF & _
"https://regex101.com/thing/blah.foo" & @CRLF & _
"https://regex101.com:28801/thing/blah/patterns?where_foo=bar&where_primary_access_node=true" & @CRLF & _
"https://regex101.com:8443/thing/index.html#/landing"
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