tavern/storage/content.go

20 lines
431 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package storage
import (
"regexp"
)
var usernameRegex = `(\w+([\w\.-]+\w+)?)`
var mentionRegex = `(@\w+([\w_\.-]+\w+)?@[\w\.-]*[\w])`
var tagRegex = `(?:^|\B)([#]{1}(\w+))`
func FindMentionedActors(input string) []string {
mr := regexp.MustCompile(mentionRegex)
return mr.FindAllString(input, -1)
}
func FindMentionedTags(input string) []string {
tr := regexp.MustCompile(tagRegex)
return tr.FindAllString(input, -1)
}