Skip to content

Commit

Permalink
Fixed an error in regexp that detects map indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
dex4er committed Aug 21, 2023
1 parent 93187b2 commit bf3c6f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func AddQuotes(input string) string {
re := regexp.MustCompile(`\[([^\]*[A-Za-z_][^\]]*)\]`)
re := regexp.MustCompile(`\[([^\]]*[A-Za-z_][^\]]*)\]`)
return re.ReplaceAllStringFunc(input, func(match string) string {
return `["` + re.FindStringSubmatch(match)[1] + `"]`
})
Expand Down

0 comments on commit bf3c6f2

Please sign in to comment.