From e0d22c1100233860131b45abe453a1c196391f98 Mon Sep 17 00:00:00 2001 From: "ip.novikov" Date: Sat, 5 Dec 2020 22:11:52 +0300 Subject: [PATCH] improve regexp get shortest sequence between : and @ --- errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/errors.go b/errors.go index 369c8ca3..b37b1d97 100644 --- a/errors.go +++ b/errors.go @@ -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 }