#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?i)\b(?:(?:ht|f)tp(?:s?)\:\/\/|~\/|\/)?(?:\w+:\w+@)?((?:(?:[-\w\d{1-3}]+\.)+(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|edu|co\.uk|ac\.uk|it|fr|tv|museum|asia|local|travel|[a-z]{2}))|((\b25[0-5]\b|\b[2][0-4][0-9]\b|\b[0-1]?[0-9]?[0-9]\b)(\.(\b25[0-5]\b|\b[2][0-4][0-9]\b|\b[0-1]?[0-9]?[0-9]\b)){3}))(?::[\d]{1,5})?(?:(?:(?:\/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|\/)+|\?|#)?(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=?(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=?(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?:#(?:[-\w~!$ |\/.,*:;=]|%[a-f\d]{2})*)?\b"
Local $sString = "# valid" & @CRLF & _
"http://www.google.com" & @CRLF & _
"ftp://example.com" & @CRLF & _
"google.com" & @CRLF & _
"a.google.com" & @CRLF & _
"a.google.com/b/~user" & @CRLF & _
"http://www.google.com/~user" & @CRLF & _
"www.google.com/sdfa/asdf?f93+3234" & @CRLF & _
"accounts.google.com" & @CRLF & _
"valid.domain.com/foasdf/~23423lj" & @CRLF & _
"accounts.google.com/login?res=sdfs sdf" & @CRLF & _
"accounts.google.com" & @CRLF & _
"you.name" & @CRLF & _
"you.name/~joe" & @CRLF & _
"google.com/+joe" & @CRLF & _
"https://joe:test@test.com" & @CRLF & _
"" & @CRLF & _
"# partial " & @CRLF & _
"http://joe@test.com" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"# invalid" & @CRLF & _
"not: " & @CRLF & _
"ftp://example" & @CRLF & _
"something.asfdasjdlf;" & @CRLF & _
"abc.def@#$90fai" & @CRLF & _
"something.like.this" & @CRLF & _
"abc.def" & @CRLF & _
"" & @CRLF & _
"" & @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