#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mix)^\#\s* # must start with "#" to indicate beeing a repo." & @CRLF & _
"(?:@?@?(?!-)(?P<user>(?:[a-zA-Z0-9]|-(?!-))+[a-zA-Z0-9])(?![^\x00-\x7F]))? # Username part" & @CRLF & _
"(?:(?<=\#)|[/\s\.](?<!\v))(?P<repo>[a-zA-Z0-9_.-]+)$"
Local $sString = "#@luckydonald/bonbot" & @CRLF & _
"#@luckydonald.bonbot" & @CRLF & _
"#@luckydonald bonbot" & @CRLF & _
"#luckydonald/bonbot" & @CRLF & _
"#luckydonald bonbot" & @CRLF & _
"#luckydonald.bonbot" & @CRLF & _
"#luckydonald/.home" & @CRLF & _
"#luckydonald..home" & @CRLF & _
"#luckydonald .home" & @CRLF & _
"#/bonbot" & @CRLF & _
"#bonbot" & @CRLF & _
"#.bonbot" & @CRLF & _
"#bonbot" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"## Not allowed: ##" & @CRLF & _
"" & @CRLF & _
"@luckydonald .home" & @CRLF & _
"luckydonald/home" & @CRLF & _
"##lol/bar" & @CRLF & _
"#@lilz" & @CRLF & _
"#@lol@huu" & @CRLF & _
"#lol wut lol" & @CRLF & _
"#-invalid/ho" & @CRLF & _
"#@-invalid/yo" & @CRLF & _
"#lolol-/möp" & @CRLF & _
"#möü/sdds"
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