update with QuoteMeta

This commit is contained in:
gobwas 2016-02-25 00:42:32 +03:00
parent 04523b0f59
commit badfcd8171
1 changed files with 4 additions and 1 deletions

View File

@ -25,6 +25,10 @@ func main() {
g = glob.MustCompile("*.github.com") g = glob.MustCompile("*.github.com")
g.Match("api.github.com") // true g.Match("api.github.com") // true
// quote meta characters and then create simple glob
g = glob.MustCompile(glob.QuoteMeta("*.github.com"))
g.Match("*.github.com") // true
// create new glob with set of delimiters as ["."] // create new glob with set of delimiters as ["."]
g = glob.MustCompile("api.*.com", '.') g = glob.MustCompile("api.*.com", '.')
g.Match("api.github.com") // true g.Match("api.github.com") // true
@ -76,7 +80,6 @@ func main() {
g.Match("fat") // true g.Match("fat") // true
g.Match("at") // false g.Match("at") // false
// create glob with pattern-alternatives list // create glob with pattern-alternatives list
g = glob.MustCompile("{cat,bat,[fr]at}") g = glob.MustCompile("{cat,bat,[fr]at}")
g.Match("cat") // true g.Match("cat") // true