fix greedy matching of bracketed escapes

This commit is contained in:
Shivaram Lingamneni 2021-01-06 16:48:14 -05:00
parent 4e36cb3f41
commit dc3b93380a
2 changed files with 2 additions and 1 deletions

View File

@ -102,7 +102,7 @@ var (
"default": "99",
}
bracketedExpr = regexp.MustCompile(`^\[.*\]`)
bracketedExpr = regexp.MustCompile(`^\[.*?\]`)
colourDigits = regexp.MustCompile(`^[0-9]{1,2}$`)
)

View File

@ -38,6 +38,7 @@ var unescapetests = []testcase{
{"te$c[04,03]9st", "te\x0304,039st"},
{"te$c[asdf !23a fd4*#]st", "te\x03st"},
{"te$c[asdf , !2,3a fd4*#]st", "te\x03st"},
{"Client opered up $c[grey][$r%s$c[grey], $r%s$c[grey]]", "Client opered up \x0314[\x0f%s\x0314, \x0f%s\x0314]"},
}
var stripTests = []testcase{