#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?imu)^(https?://)?((www\.)?t(elegram)?\.(dog|me)/((?![_\d])(?!.*__)(?!.*_$)\w{4,}[a-z\d]|[\w\+-]{13,17})|(?![_\d])(?!.*__)(?!.*_$)\w{4,}[a-z\d]\.(t(elegram)?\.(dog|me)))"
Local $sString = "https://t.me/+-k0L3asdxMc2Mjc8" & @CRLF & _
"https://t.me/telegram" & @CRLF & _
"telegram.t.me" & @CRLF & _
"telegram.telegram.me" & @CRLF & _
"t.me/telegram" & @CRLF & _
"https://www.t.me/+-k0L3asdxMc2Mjc8" & @CRLF & _
"telegram.t.me" & @CRLF & _
"tel_egram.t.me" & @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