// create new glob with set of delimiters as ["."]
g=glob.MustCompile("api.*.com",'.')
g.Match("api.github.com")// true
g.Match("api.gi.hub.com")// false
// create new glob with set of delimiters as ["."]
// but now with super wildcard
g=glob.MustCompile("api.**.com",'.')
g.Match("api.github.com")// true
g.Match("api.gi.hub.com")// true
// create glob with single symbol wildcard
g=glob.MustCompile("?at")
g.Match("cat")// true
g.Match("fat")// true
g.Match("at")// false
// create glob with single symbol wildcard and delimiters ['f']
g=glob.MustCompile("?at",'f')
g.Match("cat")// true
g.Match("fat")// false
g.Match("at")// false
// create glob with character-list matchers
g=glob.MustCompile("[abc]at")
g.Match("cat")// true
g.Match("bat")// true
g.Match("fat")// false
g.Match("at")// false
// create glob with character-list matchers
g=glob.MustCompile("[!abc]at")
g.Match("cat")// false
g.Match("bat")// false
g.Match("fat")// true
g.Match("at")// false
// create glob with character-range matchers
g=glob.MustCompile("[a-c]at")
g.Match("cat")// true
g.Match("bat")// true
g.Match("fat")// false
g.Match("at")// false
// create glob with character-range matchers
g=glob.MustCompile("[!a-c]at")
g.Match("cat")// false
g.Match("bat")// false
g.Match("fat")// true
g.Match("at")// false
// create glob with pattern-alternatives list
g=glob.MustCompile("{cat,bat,[fr]at}")
g.Match("cat")// true
g.Match("bat")// true
g.Match("fat")// true
g.Match("rat")// true
g.Match("at")// false
g.Match("zat")// false
}
```
## Performance
This library is created for compile-once patterns. This means, that compilation could take time, but
strings matching is done faster, than in case when always parsing template.
If you will not use compiled `glob.Glob` object, and do `g := glob.MustCompile(pattern); g.Match(...)` every time, then your code will be much more slower.
Run `go test -bench=.` from source root to see the benchmarks:
Pattern | Fixture | Match | Speed (ns/op)
--------|---------|-------|--------------
`[a-z][!a-x]*cat*[h][!b]*eyes*` | `my cat has very bright eyes` | `true` | 432
`[a-z][!a-x]*cat*[h][!b]*eyes*` | `my dog has very bright eyes` | `false` | 199