mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 05:02:24 -06:00
[bugfix] Make hashtag regex work with non-ascii characters (#682)
This commit is contained in:
parent
9e7d022a06
commit
664713ddd4
2 changed files with 9 additions and 4 deletions
|
|
@ -71,8 +71,8 @@ var (
|
|||
// MentionFinder extracts mentions from a piece of text.
|
||||
MentionFinder = regexp.MustCompile(mentionFinder)
|
||||
|
||||
// hashtag regex can be played with here: https://regex101.com/r/bPxeca/1
|
||||
hashtagFinder = fmt.Sprintf(`(?:^|\s)(?:#*)(#[a-zA-Z0-9]{1,%d})(?:#|\b)`, maximumHashtagLength)
|
||||
// hashtag regex can be played with here: https://regex101.com/r/bpyGlj/1
|
||||
hashtagFinder = fmt.Sprintf(`(?:^|\s)(?:#*)(#[\p{L}\p{N}]{1,%d})(?:#|\b)`, maximumHashtagLength)
|
||||
// HashtagFinder finds possible hashtags in a string.
|
||||
// It returns just the string part of the hashtag, not the # symbol.
|
||||
HashtagFinder = regexp.MustCompile(hashtagFinder)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue