improve regexp

get shortest sequence between : and @
query-exec-mode
ip.novikov 2020-12-05 22:11:52 +03:00 committed by ip.novikov
parent a581247a12
commit e0d22c1100
1 changed files with 1 additions and 1 deletions

View File

@ -178,7 +178,7 @@ func redactPW(connString string) string {
connString = quotedDSN.ReplaceAllLiteralString(connString, "password=xxxxx")
plainDSN := regexp.MustCompile(`password=[^ ]*`)
connString = plainDSN.ReplaceAllLiteralString(connString, "password=xxxxx")
brokenURL := regexp.MustCompile(`:\w.*@`)
brokenURL := regexp.MustCompile(`:[^:@]+?@`)
connString = brokenURL.ReplaceAllLiteralString(connString, ":xxxxxx@")
return connString
}