From: Edgar HIPP Date: Sat, 16 Jan 2016 07:36:29 +0000 (+0100) Subject: Correct version number X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=527e5c047afef98191ee5a8120c00faffcfa9ef5;hp=176b4e29e490f65f1acf5247daf711737c9c43b3;p=path-extractor.git Correct version number --- diff --git a/pe_test.go b/pe_test.go index 677161c..bc07d27 100644 --- a/pe_test.go +++ b/pe_test.go @@ -132,6 +132,11 @@ func TestEverything(t *testing.T) { t.Errorf("Matches version number", output) } + output = GetAllMatches("14.22.2", "") + if len(output) != 0 { + t.Errorf("Matches version number", output) + } + output = GetAllMatches("~/v1.2/js", "") if len(output) != 1 { t.Errorf("Should match path with version inside", output) diff --git a/validators.go b/validators.go index 38704c7..60a817c 100644 --- a/validators.go +++ b/validators.go @@ -52,7 +52,7 @@ func replaceGitPath(input string) string { } func isVersion(input string) bool { - r := regexp.MustCompile("^v?[0-9x]\\.[0-9x]{1,2}(\\.[0-9x]{1,3})?$") + r := regexp.MustCompile("^v?[0-9x]{1,3}\\.[0-9x]{1,3}(\\.[0-9x]{1,3})?$") return r.Match([]byte(input)) }