#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?ui)(?:^|_|[^\w&/]+)(?:#|#)([\wÀ-ÖØ-öø-ÿ]+)"
Local $sString = "Hashtags" & @CRLF & _
"#hashtag text" & @CRLF & _
"#hashtag" & @CRLF & _
"text #hashtag" & @CRLF & _
"text #1tag" & @CRLF & _
"text.#hashtag" & @CRLF & _
"text #hashtag" & @CRLF & _
"text #hashtag!" & @CRLF & _
"text #hashtag1 #hashtag2" & @CRLF & _
"" & @CRLF & _
"text #hash_tagüäö" & @CRLF & _
"text #hash0tag" & @CRLF & _
"text #hash_tag" & @CRLF & _
"" & @CRLF & _
"Hashtags non-ACSII" & @CRLF & _
"#хэш_тег" & @CRLF & _
"#中英字典" & @CRLF & _
"#الأبجدية" & @CRLF & _
"" & @CRLF & _
"Not hashtags" & @CRLF & _
"text #1234 # Match! Because we use simplistic version. Need to further filter out." & @CRLF & _
"&#nbsp;" & @CRLF & _
"text#hashtag" & @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