From 64332c3e6a6c4962fa4e48363bc0951be83b1041 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 25 Aug 2022 23:58:03 +0800 Subject: [PATCH] chore: update tag regexp --- server/tag.go | 2 +- web/src/helpers/consts.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/tag.go b/server/tag.go index 19c123da..f8ac6e0d 100644 --- a/server/tag.go +++ b/server/tag.go @@ -47,7 +47,7 @@ func (s *Server) registerTagRoutes(g *echo.Group) { tagMapSet := make(map[string]bool) - r := regexp.MustCompile(`#([^\s]+?) `) + r := regexp.MustCompile(`#([^\s#]+?) `) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to compile regexp").SetInternal(err) } diff --git a/web/src/helpers/consts.ts b/web/src/helpers/consts.ts index 2af38a03..c72be819 100644 --- a/web/src/helpers/consts.ts +++ b/web/src/helpers/consts.ts @@ -11,7 +11,7 @@ export const TOAST_ANIMATION_DURATION = 400; export const DAILY_TIMESTAMP = 3600 * 24 * 1000; // tag regex -export const TAG_REG = /#(\S+?) /g; +export const TAG_REG = /#([^\s#]+?) /g; // markdown image regex export const IMAGE_URL_REG = /!\[.*?\]\((.+?)\)/g;