fix regex
This commit is contained in:
parent
0d49b3e716
commit
0f1586393b
@ -259,7 +259,7 @@ func (c *Config) Status() (ok bool) {
|
||||
}
|
||||
|
||||
func cleanKey(key string) string {
|
||||
expr := regexp.MustCompile("__+")
|
||||
expr := regexp.MustCompile("(?:^_+)|(?:_+(?=_))|(?:_$)")
|
||||
fn := func(r rune) rune {
|
||||
if (r >= '0' && r <= '9') || (r >= 'A' && r <= 'Z') || r == '_' {
|
||||
return r
|
||||
@ -268,7 +268,7 @@ func cleanKey(key string) string {
|
||||
}
|
||||
|
||||
key = strings.Map(fn, strings.ToUpper(key))
|
||||
return expr.ReplaceAllString(key, "_")
|
||||
return expr.ReplaceAllString(key, "")
|
||||
}
|
||||
|
||||
func keySplit(key string) (left string, right string, ok bool) {
|
||||
|
Loading…
Reference in New Issue
Block a user