]> Sergey Matveev's repositories - path-extractor.git/blobdiff - validators.go
Tests workability
[path-extractor.git] / validators.go
index 5f67fdbc47851f7a3812d02b63799cf9175a2368..df6daf5c5a1f74750050fbd947ba495baef616b2 100644 (file)
@@ -51,8 +51,18 @@ func replaceGitPath(input string) string {
        return string(temp[1])
 }
 
+func isIp(input string) bool {
+       r := regexp.MustCompile("^[0-9]{1,3}\\.[0-9x]{1,3}\\.[0-9x]{1,3}\\.[0-9x]{1,3}$")
+       return r.Match([]byte(input))
+}
+
 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))
+}
+
+func isSpace(input string) bool {
+       r := regexp.MustCompile("^[0-9]*\\.[0-9]+[MGK]$")
        return r.Match([]byte(input))
 }
 
@@ -77,7 +87,7 @@ func endsWithInvalidString(input string) bool {
 }
 
 func containsInvalidString(input string) bool {
-       invalidStrings := []string{"//", "()", "and/or", "origin/", "{", "}", "<", ">", "$", "*", "this."}
+       invalidStrings := []string{"//", "()", "and/or", "remotes/", "origin/", "{", "}", "<", ">", "$", "*", "this."}
        for _, s := range invalidStrings {
                if strings.Contains(input, s) {
                        return true