From: Edgar HIPP Date: Sun, 30 Aug 2015 15:07:15 +0000 (+0200) Subject: More matches (with _) X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=70132c8c4dc291193c368e3e42742b461c4d5bb8;hp=7506d22f2038de3e0352ece65362bb94e651be5e;p=path-extractor.git More matches (with _) --- diff --git a/extractor.go b/extractor.go index 4dce18f..7cf69e4 100644 --- a/extractor.go +++ b/extractor.go @@ -9,7 +9,7 @@ type MatchOptions struct { } func pathExtractor(input string) [][][]byte { - surroundRegex := "[@~\\-a-zA-Z/.0-9]*" + 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 f0f013b..2deeae7 100644 --- a/pe_test.go +++ b/pe_test.go @@ -18,6 +18,11 @@ func TestEverything(t *testing.T) { t.Errorf("Doesn't match statement correctly", output) } + output = GetAllMatches("/usr_b/bin", MatchOptions{}) + if output[0] != "/usr_b/bin" { + t.Errorf("Doesn't match statement correctly", output) + } + output = GetAllMatches("\"/usr/bin", MatchOptions{}) if output[0] != "/usr/bin" { t.Errorf("Doesn't match statement correctly", output)