From: Edgar HIPP Date: Sun, 30 Aug 2015 15:07:14 +0000 (+0200) Subject: Update tests and extractor X-Git-Url: http://www.git.stargrave.org/?p=path-extractor.git;a=commitdiff_plain;h=7506d22f2038de3e0352ece65362bb94e651be5e Update tests and extractor --- diff --git a/extractor.go b/extractor.go index 678f009..4dce18f 100644 --- a/extractor.go +++ b/extractor.go @@ -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) diff --git a/pe_test.go b/pe_test.go index a9c1558..f0f013b 100644 --- a/pe_test.go +++ b/pe_test.go @@ -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)