package shared

import (
	"regexp"
	"strings"

	"git.mstar.dev/mstar/goutils/sliceutils"
)

var tagRegex = regexp.MustCompile(`#(\w+)`)

func TagsFromText(text string) []string {
	matches := tagRegex.FindAllString(text, -1)
	return sliceutils.Map(matches, func(t string) string { return strings.TrimPrefix(t, "#") })
}
