From a7428315e35e6e3581286392880bc83eec0e3154 Mon Sep 17 00:00:00 2001 From: Arsen Musayelyan Date: Mon, 30 Nov 2020 15:40:40 -0800 Subject: [PATCH] Fix flag removal regex --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 37cabd8..8c884b8 100644 --- a/main.go +++ b/main.go @@ -64,11 +64,11 @@ func main() { } // Create regex to remove all flags using ";;;" as it is uncommon to use in command line - flagRegex := regexp.MustCompile(`-+[^;]*;;;`) + flagRegex := regexp.MustCompile(`(?m)(;;;|^)-+[^;]*;;;`) // Join args into string argsStr := strings.Join(args, ";;;") // Remove all flags from join args - argsStr = flagRegex.ReplaceAllString(argsStr, "") + argsStr = flagRegex.ReplaceAllString(argsStr, "$1") // Separate args back into slice args = strings.Split(argsStr, ";;;")