summaryrefslogtreecommitdiff
path: root/internal/regexes/regexes.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-09-30 18:11:57 +0200
committerLibravatar GitHub <noreply@github.com>2021-09-30 18:11:57 +0200
commit28b6ce59d6e19603605f259317a9387db15505bb (patch)
tree8bc3cc4ffee12c0ac7e2945ff64df6989c7d4fb8 /internal/regexes/regexes.go
parentallow dereferencing of groups (#256) (diff)
downloadgotosocial-28b6ce59d6e19603605f259317a9387db15505bb.tar.xz
don't catch mentions within links (#257)
Diffstat (limited to 'internal/regexes/regexes.go')
-rw-r--r--internal/regexes/regexes.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/regexes/regexes.go b/internal/regexes/regexes.go
index 8ac31ef62..93d672d3c 100644
--- a/internal/regexes/regexes.go
+++ b/internal/regexes/regexes.go
@@ -52,8 +52,8 @@ var (
// such as @whatever_user@example.org, returning whatever_user and example.org (without the @ symbols)
MentionName = regexp.MustCompile(mentionName)
- // mention regex can be played around with here: https://regex101.com/r/qwM9D3/1
- mentionFinder = `(?:\B)(@\w+(?:@[a-zA-Z0-9_\-\.]+)?)(?:\B)?`
+ // mention regex can be played around with here: https://regex101.com/r/G1oGR0/1
+ mentionFinder = `(?:^|\s)(@\w+(?:@[a-zA-Z0-9_\-\.]+)?)`
// MentionFinder extracts mentions from a piece of text.
MentionFinder = regexp.MustCompile(mentionFinder)