#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?i)((https?|ftp):\/\/)?([a-z0-9+!*(),;?&=.-]+(:[a-z0-9+!*(),;?&=.-]+)?@)?([a-z0-9\-\.]*)\.(([a-z]{2,4})|([0-9]{1,3}\.([0-9]{1,3})\.([0-9]{1,3})))(:[0-9]{2,5})?(\/([a-z0-9+%-]\.?)+)*\/?(\?[a-z+&$_.-][a-z0-9;:@&%=+/.-]*)?(#[a-z_.-][a-z0-9+$%_.-]*)?"
Local $sString = "rew ewrwe http://192.168.1.100:10/" & @CRLF & _
"erewrw ew 192.168.1.100/1e rwerrewdsfsdf " & @CRLF & _
"werew rrew we vk.com we ewr werw" & @CRLF & _
" erewr http://vk.com/ ewrwe" & @CRLF & _
"ewrew https://vk.com/ werew" & @CRLF & _
"www.vk.com" & @CRLF & _
"my age is : 60. and ..." & @CRLF & _
"ятх.рф" & @CRLF & _
"ыщьу ... dfggd" & @CRLF & _
"" & @CRLF & _
"Служу в армии?" & @CRLF & _
"Еще целый год терпеть это убожество" & @CRLF & _
"Ростом 1.90 см?" & @CRLF & _
"За остальным в л.с :)" & @CRLF & _
"" & @CRLF & _
"http://test.test-75.1474.stackoverflow.com/" & @CRLF & _
"https://www.stackoverflow.com" & @CRLF & _
"https://www.stackoverflow.com/" & @CRLF & _
"http://wwww.stackoverflow.com/" & @CRLF & _
"http://wwww.stackoverflow.com" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"http://test.test-75.1474.stackoverflow.com/" & @CRLF & _
"http://www.stackoverflow.com" & @CRLF & _
"http://www.stackoverflow.com/" & @CRLF & _
"stackoverflow.com/" & @CRLF & _
"stackoverflow.com" & @CRLF & _
"" & @CRLF & _
"http://www.example.com/etcetc" & @CRLF & _
"www.example.com/etcetc" & @CRLF & _
"example.com/etcetc" & @CRLF & _
"user:pass@example.com/etcetc" & @CRLF & _
"" & @CRLF & _
"example.com/etcetc?query=aasd" & @CRLF & _
"example.com/etcetc?query=aasd&dest=asds" & @CRLF & _
"" & @CRLF & _
"http://stackoverflow.com/questions/6427530/regular-expression-pattern-to-match-url-with-or-without-http-www" & @CRLF & _
"http://stackoverflow.com/questions/6427530/regular-expression-pattern-to-match-url-with-or-without-http-www/" & @CRLF & _
"my age is: 60. and ..."
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