]> Sergey Matveev's repositories - path-extractor.git/blobdiff - extractor.go
Cyrillic support
[path-extractor.git] / extractor.go
index 11161a31f2795feb2d0b8b3bb591e295586d1c97..3183109418b35e00912f87c1420e5a98e7e0b569 100644 (file)
@@ -9,7 +9,7 @@ type MatchOptions struct {
 }
 
 func pathExtractor(input string) [][]int {
-       surroundRegex := "[@~\\-_a-zA-Z/.0-9]*"
+       surroundRegex := "[@~\\-_a-zA-ZА-Яа-яЁё/.0-9]*"
        r := regexp.MustCompile("(" + surroundRegex + "[\\./]" + surroundRegex + ")")
        return r.FindAllSubmatchIndex([]byte(input), -1)
 }
@@ -41,7 +41,7 @@ func GetAllMatches(input string, format string) []string {
                        continue
                }
 
-               if isEmail(candidatePath) || isDate(candidatePath) || isVersion(candidatePath) || isGitRange(candidatePath) || isGitInstruction(candidatePath) || startsWithInvalidString(candidatePath) || endsWithInvalidString(candidatePath) || containsInvalidString(candidatePath) || len(candidatePath) <= 2 {
+               if isIp(candidatePath) || isEmail(candidatePath) || isDate(candidatePath) || isVersion(candidatePath) || isGitRange(candidatePath) || isGitInstruction(candidatePath) || startsWithInvalidString(candidatePath) || endsWithInvalidString(candidatePath) || containsInvalidString(candidatePath) || len(candidatePath) <= 2 || isSpace(candidatePath) {
                        continue
                }
                if isGitPath(candidatePath) {