gobwas / glob

Go glob
MIT License
948 stars 63 forks source link

Unexpected escaping behavior #38

Open aeneasr opened 4 years ago

aeneasr commented 4 years ago

Take the following code:

package main

import (
    "fmt"

    "github.com/gobwas/glob"
)

func main() {
    var g glob.Glob

    // create simple glob
    g = glob.MustCompile("foo\\bar")
    fmt.Printf("%+v", g.Match("foo\\bar"))
}

It returns false although I would expect true. Using fmt.Printf("%+v", g.Match("foobar")) return true, although I would expect false.

aeneasr commented 4 years ago

I understand now that \\b matches literal b. To achieve the above I would need to use foo\\\\bar