mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-09 22:47:29 -06:00
work on emojis
This commit is contained in:
parent
de9718c566
commit
32629a378d
31 changed files with 605 additions and 67 deletions
|
|
@ -19,22 +19,9 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
// mention regex can be played around with here: https://regex101.com/r/qwM9D3/1
|
||||
mentionRegexString = `(?: |^|\W)(@[a-zA-Z0-9_]+(?:@[a-zA-Z0-9_\-\.]+)?)(?: |\n)`
|
||||
mentionRegex = regexp.MustCompile(mentionRegexString)
|
||||
// hashtag regex can be played with here: https://regex101.com/r/Vhy8pg/1
|
||||
hashtagRegexString = `(?: |^|\W)?#([a-zA-Z0-9]{1,30})(?:\b|\r)`
|
||||
hashtagRegex = regexp.MustCompile(hashtagRegexString)
|
||||
// emoji regex can be played with here: https://regex101.com/r/478XGM/1
|
||||
emojiRegexString = `(?: |^|\W)?:([a-zA-Z0-9_]{2,30}):(?:\b|\r)?`
|
||||
emojiRegex = regexp.MustCompile(emojiRegexString)
|
||||
)
|
||||
|
||||
// DeriveMentions takes a plaintext (ie., not html-formatted) status,
|
||||
// and applies a regex to it to return a deduplicated list of accounts
|
||||
// mentioned in that status.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue