From eaf4460134b84487698c9e18de3ea065a7a357eb Mon Sep 17 00:00:00 2001 From: Robin Schubert Date: Thu, 28 Mar 2024 14:31:25 +0100 Subject: [PATCH] updated tag regex and compiled it once globally --- display/display.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display/display.go b/display/display.go index e8f6352..17178e4 100644 --- a/display/display.go +++ b/display/display.go @@ -31,6 +31,7 @@ var bottomBar = cview.NewInputField() var originalText []byte var searchBar = cview.NewInputField() +var tagsRegex = regexp.MustCompile(`\[[a-zA-Z0-9_,;: \-\."#]+[^\[]*\]`) var searchString = "" var matches = 0 var curMatch = 0 @@ -295,7 +296,6 @@ func Init(version, commit, builtBy string) { searchIdx := searchRegex.FindAllIndex(originalText, -1) // find all positions of tags - tagsRegex := regexp.MustCompile(`\[.*?[^\[]\]`) tagsIdx := tagsRegex.FindAllIndex(originalText, -1) text := []byte("")