#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?<scheme>[a-zA-Z][a-zA-Z0-9-+.]*)://(?:(?<username>(?:[\w-]|%\d\d)+)(?::(?<passwd>(?:[\w-]|%\d\d)*))?@)?(?<host>(?:[a-zA-Z][a-zA-Z0-9-]*\.?)+|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(?<port>:\d+)?(?<path>(?:/(?:[\w-.:]|%\d\d)+)+/?|/)?(?<query>\?(?:(?:[\w-]|%\d\d)+(?:=[\w]+)?(?:&|$))*)?(?<fragment>#.*)?$"
Local $sString = "https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax" & @CRLF & _
"(↑ assuming URL, not URI; the only difference is that the host is mandatory)" & @CRLF & _
"" & @CRLF & _
"https://regex101.com/" & @CRLF & _
"https://e./" & @CRLF & _
"https://org." & @CRLF & _
"https://elearning.tgm.ac.at/pluginfile.php/297744/mod_resource/content/0/SEW5_UML_Einfuehrung.pdf" & @CRLF & _
"https://elearning.tgm.ac.at/mod/page/view.php?id%40_-ae=212356" & @CRLF & _
"https://elearning.tgm.ac.at/mod/assign/view.php?id=212239" & @CRLF & _
"https://elearning.tgm.ac.at/course/view.php?id=5454§ion=4" & @CRLF & _
"nonstandardscheme://is.still.valid" & @CRLF & _
"http://he.e/?" & @CRLF & _
"https://hy.a?a" & @CRLF & _
"http://h.?a&b&c=a" & @CRLF & _
"https://e.o.a." & @CRLF & _
"http://0riedler:0%20tab-a_sco@riedler.a.wien/" & @CRLF & _
"http://emptypasswd:@riedler.wien/" & @CRLF & _
"http://a.e:33/" & @CRLF & _
"https://de.wikipedia.org/wiki/Wikipedia:Hauptseite" & @CRLF & _
"https://de.wikipedia.org/wiki/Preiselbeersauce#Zubereitung" & @CRLF & _
"https://toptoptoptoptoptoptoptoptoptoptoptoptoptoptoptoptoptoptoptop.top/" & @CRLF & _
"https://9.9.9.9/ipv4" & @CRLF & _
"https://2620:fe::fe/ipv6" & @CRLF & _
"ipv6 addresses are their own source of evil, not implementing those for now"
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