improve regexp
get shortest sequence between : and @
This commit is contained in:
@@ -178,7 +178,7 @@ func redactPW(connString string) string {
|
|||||||
connString = quotedDSN.ReplaceAllLiteralString(connString, "password=xxxxx")
|
connString = quotedDSN.ReplaceAllLiteralString(connString, "password=xxxxx")
|
||||||
plainDSN := regexp.MustCompile(`password=[^ ]*`)
|
plainDSN := regexp.MustCompile(`password=[^ ]*`)
|
||||||
connString = plainDSN.ReplaceAllLiteralString(connString, "password=xxxxx")
|
connString = plainDSN.ReplaceAllLiteralString(connString, "password=xxxxx")
|
||||||
brokenURL := regexp.MustCompile(`:\w.*@`)
|
brokenURL := regexp.MustCompile(`:[^:@]+?@`)
|
||||||
connString = brokenURL.ReplaceAllLiteralString(connString, ":xxxxxx@")
|
connString = brokenURL.ReplaceAllLiteralString(connString, ":xxxxxx@")
|
||||||
return connString
|
return connString
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user