]> Sergey Matveev's repositories - path-extractor.git/commitdiff
Update tests and extractor
authorEdgar HIPP <hipp.edg@gmail.com>
Sun, 30 Aug 2015 15:07:14 +0000 (17:07 +0200)
committerEdgar HIPP <hipp.edg@gmail.com>
Sun, 30 Aug 2015 15:07:14 +0000 (17:07 +0200)
extractor.go
pe_test.go

index 678f009e50a5b7c92375f0924744625036efac20..4dce18fbbb77923a2c2f77ca1b37c49821bb6730 100644 (file)
@@ -9,7 +9,7 @@ type MatchOptions struct {
 }
 
 func pathExtractor(input string) [][][]byte {
-       surroundRegex := "[@~a-zA-Z/.]*"
+       surroundRegex := "[@~\\-a-zA-Z/.0-9]*"
        r := regexp.MustCompile("(" + surroundRegex + "[\\./]" + surroundRegex + ")")
        temp := [][][]byte{}
        temp = r.FindAllSubmatch([]byte(input), -1)
index a9c15589ce9d89c5ae70ca007233509b274ea377..f0f013bea2d9c69a9b8cc8b12cacef6ec9be97fb 100644 (file)
@@ -82,6 +82,11 @@ func TestEverything(t *testing.T) {
                t.Errorf("Matches this.user", output)
        }
 
+       output = GetAllMatches("To https://test@test.org/88/ls.git", MatchOptions{})
+       if len(output) != 0 {
+               t.Errorf("Matches email adresses", output)
+       }
+
        output = GetAllMatches(" mail@mail.com ", MatchOptions{})
        if len(output) != 0 {
                t.Errorf("Matches email adresses", output)