修正了解析§格式的大小写敏感问题

This commit is contained in:
Tnze
2019-06-19 01:51:50 +08:00
parent 8c0b0e89ab
commit 840e4b1cf8
2 changed files with 4 additions and 1 deletions

View File

@ -167,7 +167,7 @@ func (m Message) String() string {
return msg.String()
}
var fmtPat = regexp.MustCompile("§[0-9A-FK-OR]")
var fmtPat = regexp.MustCompile("(?i)§[0-9A-FK-OR]")
func transf(str string, ansi bool) string {
return fmtPat.ReplaceAllStringFunc(

View File

@ -29,6 +29,7 @@ var jsons = []string{
`"Tnze"`,
`"§0Tnze"`,
`"§list"`,
}
var texts = []string{
@ -43,6 +44,7 @@ var texts = []string{
"Tnze",
"\033[30mTnze",
"\033[1mist",
}
var ctexts = []string{
@ -57,6 +59,7 @@ var ctexts = []string{
"Tnze",
"Tnze",
"ist",
}
func TestChatMsgFormatString(t *testing.T) {