#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-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})"
Local $sString = "https://www.facebook.com" & @CRLF & _
"https://app-1.number123.com" & @CRLF & _
"http://facebook.com" & @CRLF & _
"ftp://facebook.com" & @CRLF & _
"http://localhost:3000" & @CRLF & _
"localhost:3000/" & @CRLF & _
"unitedkingdomurl.co.uk" & @CRLF & _
"this.is.a.url.com/its/still=going?wow" & @CRLF & _
"shop.facebook.org" & @CRLF & _
"app.number123.com" & @CRLF & _
"app1.number123.com" & @CRLF & _
"app-1.numbEr123.com" & @CRLF & _
"app.dashes-dash.com" & @CRLF & _
"www.facebook.com" & @CRLF & _
"facebook.com" & @CRLF & _
"fb.com/hello_123" & @CRLF & _
"fb.com/hel-lo" & @CRLF & _
"fb.com/hello/goodbye" & @CRLF & _
"fb.com/hello/goodbye?okay" & @CRLF & _
"fb.com/hello/goodbye?okay=alright" & @CRLF & _
"Hello www.google.com World http://yahoo.com" & @CRLF & _
"https://www.google.com.tr/admin/subPage?qs1=sss1&qs2=sss2&qs3=sss3#Services" & @CRLF & _
"https://google.com.tr/test/subPage?qs1=sss1&qs2=sss2&qs3=sss3#Services" & @CRLF & _
"http://google.com/test/subPage?qs1=sss1&qs2=sss2&qs3=sss3#Services" & @CRLF & _
"ftp://google.com/test/subPage?qs1=sss1&qs2=sss2&qs3=sss3#Services" & @CRLF & _
"www.google.com.tr/test/subPage?qs1=sss1&qs2=sss2&qs3=sss3#Services" & @CRLF & _
"www.google.com/test/subPage?qs1=sss1&qs2=sss2&qs3=sss3#Services" & @CRLF & _
"drive.google.com/test/subPage?qs1=sss1&qs2=sss2&qs3=sss3#Services" & @CRLF & _
"https://www.example.pl" & @CRLF & _
"http://www.example.com" & @CRLF & _
"www.example.pl" & @CRLF & _
"example.com" & @CRLF & _
"http://blog.example.com" & @CRLF & _
"http://www.example.com/product" & @CRLF & _
"http://www.example.com/products?id=1&page=2" & @CRLF & _
"http://www.example.com#up" & @CRLF & _
"http://255.255.255.255" & @CRLF & _
"255.255.255.255" & @CRLF & _
"shop.facebook.org/derf.html " & @CRLF & _
"Sample:test" & @CRLF & _
"tenor.com/view" & @CRLF & _
"This is a sentence. It has many components to it. Like this non-shady URL link.co or 194.092.103.64:2000 or homelabdomain:80"
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