mirror of https://github.com/gobwas/glob.git
update with QuoteMeta
This commit is contained in:
parent
04523b0f59
commit
badfcd8171
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue