#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^((?:https?://(?:www\.)?|www\.)(?:(?!-)[A-Za-z0-9-]+\.[a-z]+)(?:\/[A-Za-z0-9-_]+\/?)*(?:[?&][A-Za-z0-9-\=\+_]+)*(?:\.[a-z]+)*)$|^((?:\d{1,3}\.){3}\d{1,3}(?:\:\d+)?)$"
Local $sString = "http://www.google.com" & @CRLF & _
"http://google.com" & @CRLF & _
"https://www.google.com" & @CRLF & _
"https://google.com" & @CRLF & _
"www.abcdefghijklmnopqrstuvwxyz123456789-.com" & @CRLF & _
"http://www.abcdefghijklmnopqrstuvwxyz123456789-.com" & @CRLF & _
"" & @CRLF & _
"https://www.crummy.com/software/wow/" & @CRLF & _
"https://www.crummy.com/software?wow=1" & @CRLF & _
"https://www.crummy.com/software/examples/hello?wow=1&yep=ok" & @CRLF & _
"https://www.crummy.com/software?wow=1+and+2&yep=ok" & @CRLF & _
"" & @CRLF & _
"https://www.crummy.com/software/BeautifulSoup/bs4/doc/_sources/index.txt" & @CRLF & _
"" & @CRLF & _
"Outliers" & @CRLF & _
"http://www.google" & @CRLF & _
"http://wwww.google.com" & @CRLF & _
"http://ww.google.com" & @CRLF & _
"https://w.g.c" & @CRLF & _
"" & @CRLF & _
"255.255.255.255:5555" & @CRLF & _
"192.168.9.50:22" & @CRLF & _
"127.0.0.1" & @CRLF & _
"127.0.0.1:8080" & @CRLF & _
"" & @CRLF & _
"www.google" & @CRLF & _
"google.com" & @CRLF & _
"google" & @CRLF & _
"" & @CRLF & _
"ww.google.c" & @CRLF & _
"ht://www.google.com" & @CRLF & _
"www.-google.com" & @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