From 73b6fdd2e1d59e3b54dbdecdf5b01efa3ba38261 Mon Sep 17 00:00:00 2001 From: Edgar HIPP Date: Sun, 30 Aug 2015 17:07:10 +0200 Subject: [PATCH] Shouldn't match // --- pe_test.go | 5 +++++ validators.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pe_test.go b/pe_test.go index 28f87f7..eefbbfe 100644 --- a/pe_test.go +++ b/pe_test.go @@ -13,6 +13,11 @@ func TestEverything(t *testing.T) { t.Errorf("Matches sentence", output) } + output = GetAllMatches("/var//log", MatchOptions{}) + if len(output) != 0 { + t.Errorf("Matches double //", output) + } + output = GetAllMatches("s/+//", MatchOptions{}) if len(output) != 0 { t.Errorf("Doesn't match substitute", output) diff --git a/validators.go b/validators.go index adc8116..042862c 100644 --- a/validators.go +++ b/validators.go @@ -67,7 +67,7 @@ func endsWithInvalidString(input string) bool { } func containsInvalidString(input string) bool { - invalidStrings := []string{"()", "and/or", "origin/", "{", "}", "<", ">", "$", "*", "this."} + invalidStrings := []string{"//", "()", "and/or", "origin/", "{", "}", "<", ">", "$", "*", "this."} for _, s := range invalidStrings { if strings.Contains(input, s) { return true -- 2.44.0