From 4ba112df2e3cdafe8dbdf53e521d8a45d1b325eb Mon Sep 17 00:00:00 2001 From: jahooma Date: Fri, 21 Jan 2022 18:07:11 -0600 Subject: [PATCH] Parse tags optionally including '#' --- common/util/parse.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/util/parse.ts b/common/util/parse.ts index 5f78125e..99e5a82c 100644 --- a/common/util/parse.ts +++ b/common/util/parse.ts @@ -10,9 +10,9 @@ export function parseTags(text: string) { } export function parseWordsAsTags(text: string) { - const regex = /(?:^|\s)(?:[a-z0-9_]+)/gi + const regex = /(?:^|\s)(?:#?[a-z0-9_]+)/gi const matches = (text.match(regex) || []) - .map((match) => match.trim()) + .map((match) => match.replace('#', '').trim()) .filter((tag) => tag) const tagSet = new Set(matches) const uniqueTags: string[] = []