#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)((http|https)+\:\/\/)?([\w\d-]+\.)*[\w-]+[\.\:]\w+([\/\?\=\&\#\.]?[\w-]+)*\/?"
Local $sString = "https://www.facebook.com" & @CRLF & _
"https://app-1.number123.com" & @CRLF & _
"http://facebook.com" & @CRLF & _
"ftp://facebook.com/faq" & @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 & _
"facebook.in" & @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 & _
"http://255.255.255.255:8080/faq" & @CRLF & _
"255.255.255.255/faq" & @CRLF & _
"shop.facebook.org/derf.html" & @CRLF & _
"" & @CRLF & _
"https://youtu.be/c30TltNg-Wk : this is valid" & @CRLF & _
"https://www.youtu.be/c30TltNg-Wk : this is invalid" & @CRLF & _
"www.youtu.be/c30TltNg-Wk : this is invalid" & @CRLF & _
"what should be there finally there in content info file?" & @CRLF & _
"youtu.be/c30TltNg-Wk or https://youtu.be/c30TltNg-Wk"
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