#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?ix)(?:" & @CRLF & _
" (?<alpha>[a-z])" & @CRLF & _
" (?<digit>[0-9])" & @CRLF & _
" (?<unreserved>\g<alpha>|\g<digit>|-|\.|_|~)" & @CRLF & _
" (?<hexdig>\g<digit>|[A-F])" & @CRLF & _
" (?<pct_encoded>%\g<hexdig>{2})" & @CRLF & _
" (?<gen_delims>[:\/\?\#\[\]@])" & @CRLF & _
" (?<sub_delims>[!\$&'\(\)\*\+,;=])" & @CRLF & _
" (?<reserved>\g<gen_delims>|\g<sub_delims>)" & @CRLF & _
"" & @CRLF & _
" (?<ip_literal>\[(?:\g<ipv6address>|\g<ipvfuture>)\])" & @CRLF & _
" (?<ipvfuture>v\g<hexdig>+\.(?:\g<unreserved>|\g<sub_delims>|:)+)" & @CRLF & _
" (?<ipv6address>" & @CRLF & _
" (?:\g<h16>:){6}\g<ls32> |" & @CRLF & _
" ::(?:\g<h16>:){5}\g<ls32> |" & @CRLF & _
" (?: \g<h16>)?::(?:\g<h16>:){4}\g<ls32> |" & @CRLF & _
" (?:(?:\g<h16>:){0,1}\g<h16>)?::(?:\g<h16>:){3}\g<ls32> |" & @CRLF & _
" (?:(?:\g<h16>:){0,2}\g<h16>)?::(?:\g<h16>:){2}\g<ls32> |" & @CRLF & _
" (?:(?:\g<h16>:){0,3}\g<h16>)?::(?:\g<h16>:){1}\g<ls32> |" & @CRLF & _
" (?:(?:\g<h16>:){0,4}\g<h16>)?:: \g<ls32> |" & @CRLF & _
" (?:(?:\g<h16>:){0,5}\g<h16>)?:: \g<h16> |" & @CRLF & _
" (?:(?:\g<h16>:){0,6}\g<h16>)?::" & @CRLF & _
" )" & @CRLF & _
" (?<h16>\g<hexdig>{1,4})" & @CRLF & _
" (?<ls32>\g<h16>:\g<h16>|\g<ipv4address>)" & @CRLF & _
"" & @CRLF & _
" (?<ipv4address>\g<dec_octet>\.\g<dec_octet>\.\g<dec_octet>\.\g<dec_octet>)" & @CRLF & _
" (?<dec_octet>" & @CRLF & _
" 25[0-5] | # 250-255" & @CRLF & _
" 2[0-4]\g<digit> | # 200-249" & @CRLF & _
" 1\g<digit>{2} | # 100-199" & @CRLF & _
" [1-9]\g<digit> | # 10-99" & @CRLF & _
" \g<digit> # 0-9" & @CRLF & _
" )" & @CRLF & _
" (?<reg_name>(?:\g<unreserved>|\g<pct_encoded>|\g<sub_delims>)*)" & @CRLF & _
" " & @CRLF & _
" (?<path_abempty>(?:\/\g<segment>)*)" & @CRLF & _
" (?<path_absoloute>\/(?:\g<segment_nz>(?:\/\g<segment>)*))" & @CRLF & _
" (?<path_noscheme>\g<segment_nz_nc>(?:\/\g<segment>)*)" & @CRLF & _
" (?<path_rootless>\g<segment_nz>(?:\/\g<segment>)*)" & @CRLF & _
" (?<path_empty>)" & @CRLF & _
" " & @CRLF & _
" (?<segment> \g<pchar>*)" & @CRLF & _
" (?<segment_nz> \g<pchar>+)" & @CRLF & _
" (?<segment_nz_nc>(?:\g<unreserved>|\g<pct_encoded>|\g<sub_delims>|@)+) # non-zero-length segment without any colon ":"" & @CRLF & _
" " & @CRLF & _
" (?<pchar>\g<unreserved>|\g<pct_encoded>|\g<sub_delims>|:|@)" & @CRLF & _
"){0}" & @CRLF & _
"" & @CRLF & _
"(?<scheme>" & @CRLF & _
" \g<alpha>" & @CRLF & _
" (?:\g<alpha>|\g<digit>|\+|-|\.)*" & @CRLF & _
")" & @CRLF & _
":" & @CRLF & _
"(?<heir_part>" & @CRLF & _
" (?:" & @CRLF & _
" \/\/" & @CRLF & _
" (?<authority>" & @CRLF & _
" (?:(?<userinfo>(?:\g<unreserved>|\g<pct_encoded>|\g<sub_delims>|:)*)@)?" & @CRLF & _
" (?<host>\g<ip_literal>|\g<ipv4address>|\g<reg_name>)" & @CRLF & _
" (?::(?<port>\g<digit>*))?" & @CRLF & _
" )" & @CRLF & _
" )?" & @CRLF & _
" (?<path>(?(<authority>)" & @CRLF & _
" \g<path_abempty> | # begins with "/" or is empty" & @CRLF & _
" (?:" & @CRLF & _
" \g<path_absoloute> | # begins with "/" but not "//"" & @CRLF & _
" \g<path_rootless> | # begins with a segment" & @CRLF & _
" \g<path_noscheme> | # begins with a non-colon segment" & @CRLF & _
" \g<path_empty> # zero characters" & @CRLF & _
" )" & @CRLF & _
" ))" & @CRLF & _
")" & @CRLF & _
"(?:\?(?<query>(?:\g<pchar>|\/|\?)*))?" & @CRLF & _
"(?:\#(?<fragment>(?:\g<pchar>|\/|\?)*))?"
Local $sString = "ftp://ftp.is.co.za/rfc/rfc1808.txt" & @CRLF & _
"http://www.ietf.org/rfc/rfc2396.txt" & @CRLF & _
"ldap://[2001:db8::7]/c=GB?objectClass?one" & @CRLF & _
"mailto:John.Doe@example.com" & @CRLF & _
"news:comp.infosystems.www.servers.unix" & @CRLF & _
"tel:+1-816-555-1212" & @CRLF & _
"telnet://192.0.2.16:80/" & @CRLF & _
"urn:oasis:names:specification:docbook:dtd:xml:4.1.2" & @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