manifold/web/lib/util/parse.ts
2021-12-31 13:41:41 -06:00

9 lines
228 B
TypeScript

export function parseTags(text: string) {
const regex = /(?:^|\s)(?:[#][a-z0-9_]+)/gi
const matches = text.match(regex) || []
return matches.map((match) => {
const tag = match.trim().substring(1)
return tag
})
}