#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?i)((https?:\/\/|www\.)(?!.*(fnac\.fr|amazon\.com|actu\.fr|youtube\.com\/watch\?.*v=|youtu\.be\/)).+)|(\w+\.\w+)$"
Local $sString = "je t'aime www.fnac.fr" & @CRLF & _
"www.amazon.com" & @CRLF & _
"https://test1.amazon.com" & @CRLF & _
"https://www.amazon.fr/sasa" & @CRLF & _
"http://url.actu.fr/b9af4a14" & @CRLF & _
"www.google.fr" & @CRLF & _
"www.lol.com" & @CRLF & _
"hi voila.fr" & @CRLF & _
"Utilisons WhatsApp, une application rapide, simple et sécurisée pour envoyer des messages et appeler gratuitement. À télécharger sur https://whatsapp.com/dl/lol" & @CRLF & _
"https://www.youtube.com/watch?v=dvPYQHLZdUk" & @CRLF & _
"Https://youtu.be/NLPyySN9Czw?si=nnOgbaHgZSeBHA6U" & @CRLF & _
"CrazyCat ça va?" & @CRLF & _
"lol comment tu vas " & @CRLF & _
"WWW.GOOGLE.FR"
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