#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?u)\B#([\p{L}\p{N}_]+)(?!#)\b"
Local $sString = "https://google.com/#test #asdasd" & @CRLF & _
"" & @CRLF & _
"#test" & @CRLF & _
"" & @CRLF & _
"#你好" & @CRLF & _
"#asdasdasd .#asdasd #asdasd#asdasd" & @CRLF & _
"" & @CRLF & _
"Works well for most languages. And requires a space in front." & @CRLF & _
"" & @CRLF & _
"##no <-- not allowed which is good." & @CRLF & _
"#yes" & @CRLF & _
"" & @CRLF & _
"#güneş" & @CRLF & _
"" & @CRLF & _
"#günşöhlesi" & @CRLF & _
"" & @CRLF & _
"Not sure why some say languages like the one above doesn't work..." & @CRLF & _
"" & @CRLF & _
"https://github.com/justoverclockl/flarum-ext-hashtag####hashtag" & @CRLF & _
"#asdasd." & @CRLF & _
"" & @CRLF & _
"#123123123+asdasd"
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