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

index f64fe5fb1a5a0beb0b365c175050779d17137a80..ad83d6eacf648a8ef98136f9534a92f97bf04e44 100644 (file)
@@ -9,7 +9,7 @@ type MatchOptions struct {
 }
 
 func pathExtractor(input string) [][][]byte {
-       surroundRegex := "[^]\\^\\+()!#[ \\t:'\"\\\\]*"
+       surroundRegex := "[^]\\^\\+()!#[ \\t:'\"\\\\=]*"
        r := regexp.MustCompile("(" + surroundRegex + "[\\./]" + surroundRegex + ")")
        temp := [][][]byte{}
        temp = r.FindAllSubmatch([]byte(input), -1)
index eefbbfe79a922799fb42f9528d9e6cbafb54b1f3..719be92364388d95299b419e370c626b57fdd7c7 100644 (file)
@@ -13,6 +13,14 @@ func TestEverything(t *testing.T) {
                t.Errorf("Matches sentence", output)
        }
 
+       output = GetAllMatches("prefix=/usr/bin", MatchOptions{})
+       if len(output) != 1 {
+               t.Errorf("Should match =/usr/bin", output)
+       }
+       if output[0] != "/usr/bin" {
+               t.Errorf("Doesn't match statement correctly", output)
+       }
+
        output = GetAllMatches("/var//log", MatchOptions{})
        if len(output) != 0 {
                t.Errorf("Matches double //", output)