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

index 4dce18fbbb77923a2c2f77ca1b37c49821bb6730..7cf69e4b8dcbe76cd58105a0fe49ef573d13f917 100644 (file)
@@ -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)
index f0f013bea2d9c69a9b8cc8b12cacef6ec9be97fb..2deeae75e91b5c61daf315ccba39ec9106ee0ba6 100644 (file)
@@ -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)