X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=extractor.go;h=3183109418b35e00912f87c1420e5a98e7e0b569;hb=HEAD;hp=e05ad4b93b50730c149315f98b68ec5655ba9fa7;hpb=6d1dd1099ee890f91afcb553e6dcdef8a65f0d0d;p=path-extractor.git diff --git a/extractor.go b/extractor.go index e05ad4b..3183109 100644 --- a/extractor.go +++ b/extractor.go @@ -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) || 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) { @@ -59,7 +59,7 @@ func GetAllMatches(input string, format string) []string { } func getCursorPosition(input string) string { - r := regexp.MustCompile("^(:[0-9]+(:[0-9]+)?)$") + r := regexp.MustCompile("^(:[0-9]+(:[0-9]+)?)") temp := [][]byte{} temp = r.FindSubmatch([]byte(input)) if len(temp) <= 1 {