#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(http:\/\/|https:\/\/)?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(:80|:443)?$|^(http:\/\/|https:\/\/)?\[[0-9a-fA-F:]+\](:80|:443)?$|^(http:\/\/|https:\/\/)?[0-9a-fA-F:]+(:80|:443)?$"
Local $sString = "http://example.com" & @CRLF & _
"https://example.com" & @CRLF & _
"http://example.com:80" & @CRLF & _
"https://example.com:80" & @CRLF & _
"http://example.com:443" & @CRLF & _
"https://example.com:443" & @CRLF & _
"example.com:80" & @CRLF & _
"example.com:443" & @CRLF & _
"http://10.255.255.1" & @CRLF & _
"https://10.255.255.1" & @CRLF & _
"http://10.255.255.1:80" & @CRLF & _
"https://10.255.255.1:80" & @CRLF & _
"http://10.255.255.1:443" & @CRLF & _
"https://10.255.255.1:443" & @CRLF & _
"10.255.255.1:80" & @CRLF & _
"10.255.255.1:443" & @CRLF & _
"http://8.8.8.8" & @CRLF & _
"https://8.8.8.8" & @CRLF & _
"http://8.8.8.8:80" & @CRLF & _
"https://8.8.8.8:80" & @CRLF & _
"http://8.8.8.8:443" & @CRLF & _
"https://8.8.8.8:443" & @CRLF & _
"8.8.8.8:80" & @CRLF & _
"8.8.8.8:443" & @CRLF & _
"8.8.8.8" & @CRLF & _
"http://[fd00::1]" & @CRLF & _
"https://[fd00::1]" & @CRLF & _
"http://[fd00::1]:80" & @CRLF & _
"https://[fd00::1]:80" & @CRLF & _
"http://[fd00::1]:443" & @CRLF & _
"https://[fd00::1]:443" & @CRLF & _
"[fd00::1]:80" & @CRLF & _
"[fd00::1]:443" & @CRLF & _
"fd00::1:80" & @CRLF & _
"fd00::1:443" & @CRLF & _
"[fd00::1]" & @CRLF & _
"fd00::1" & @CRLF & _
"http://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]" & @CRLF & _
"https://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]" & @CRLF & _
"http://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:80" & @CRLF & _
"https://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:80" & @CRLF & _
"http://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:443" & @CRLF & _
"https://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:443" & @CRLF & _
"2001:0db8:85a3:0000:0000:8a2e:0370:7334:443" & @CRLF & _
"http://[2001:db8::1]" & @CRLF & _
"https://[2001:db8::1]" & @CRLF & _
"http://[2001:db8::1]:443" & @CRLF & _
"https://[2001:db8::1]:443" & @CRLF & _
"http://[2001:db8::1]:80" & @CRLF & _
"https://[2001:db8::1]:80" & @CRLF & _
"[2001:db8::1]:80" & @CRLF & _
"[2001:db8::1]:443" & @CRLF & _
"2001:db8::1:443" & @CRLF & _
"[2001:db8::1]" & @CRLF & _
"http://[::1]" & @CRLF & _
"https://[::1]" & @CRLF & _
"http://[::1]:80" & @CRLF & _
"https://[::1]:80" & @CRLF & _
"http://[::1]:443" & @CRLF & _
"https://[::1]:443" & @CRLF & _
"[::1]:80" & @CRLF & _
"[::1]:443" & @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