#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?:(?:https?|ftp)://)?(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?"
Local $sString = "google.com" & @CRLF & _
"google.com:25687" & @CRLF & _
"126.65.23.45" & @CRLF & _
"126.65.23.45:1234" & @CRLF & _
"http://banane.de" & @CRLF & _
"https://banane.de" & @CRLF & _
"http://banane.de:25687" & @CRLF & _
"https://banane.de:25687" & @CRLF & _
"google.com/test.php" & @CRLF & _
"google.com:25687/test.php" & @CRLF & _
"126.65.23.45/test.php" & @CRLF & _
"126.65.23.45:1234/test.php" & @CRLF & _
"http://banane.de/test.php" & @CRLF & _
"https://banane.de/test.php" & @CRLF & _
"http://banane.de:25687/test.php" & @CRLF & _
"https://banane.de:25687/test.php"
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