1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-06-01 18:31:08 +00:00

updated tag regex and compiled it once globally

This commit is contained in:
Robin Schubert 2024-03-28 14:31:25 +01:00
parent 84767a39fa
commit eaf4460134

View File

@ -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("")