summaryrefslogtreecommitdiff
path: root/internal/util/regexes.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-05-15 11:58:11 +0200
committerLibravatar GitHub <noreply@github.com>2021-05-15 11:58:11 +0200
commitcc48294c31a76e94fa879ad0d8d5dbd7e94c651b (patch)
tree7c26d33b41bab33bbdfbba540958444f4c296602 /internal/util/regexes.go
parentMediahandler (#21) (diff)
downloadgotosocial-cc48294c31a76e94fa879ad0d8d5dbd7e94c651b.tar.xz
Inbox post (#22)
Inbox POST from federated servers now working for statuses and follow requests. Follow request client API added. Start work on federating outgoing messages. Other fixes and changes/tidying up.
Diffstat (limited to 'internal/util/regexes.go')
-rw-r--r--internal/util/regexes.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/util/regexes.go b/internal/util/regexes.go
index a59bd678a..adab8c87f 100644
--- a/internal/util/regexes.go
+++ b/internal/util/regexes.go
@@ -35,6 +35,11 @@ const (
)
var (
+ mentionNameRegexString = `^@([a-zA-Z0-9_]+)(?:@([a-zA-Z0-9_\-\.]+)?)$`
+ // mention name regex captures the username and domain part from a mention string
+ // such as @whatever_user@example.org, returning whatever_user and example.org (without the @ symbols)
+ mentionNameRegex = regexp.MustCompile(mentionNameRegexString)
+
// mention regex can be played around with here: https://regex101.com/r/qwM9D3/1
mentionFinderRegexString = `(?: |^|\W)(@[a-zA-Z0-9_]+(?:@[a-zA-Z0-9_\-\.]+)?)(?: |\n)`
mentionFinderRegex = regexp.MustCompile(mentionFinderRegexString)