Whether the matching should be case-sensitive
The path to be matched against
The glob pattern
true if pattern matches path, false otherwise.
assert(globMatch("foo.bar", "*")); assert(globMatch("foo.bar", "*.*")); assert(globMatch(`foo/foo\bar`, "f*b*r")); assert(globMatch("foo.bar", "f???bar")); assert(globMatch("foo.bar", "[fg]???bar")); assert(globMatch("foo.bar", "[!gh]*bar")); assert(globMatch("bar.fooz", "bar.{foo,bif}z")); assert(globMatch("bar.bifz", "bar.{foo,bif}z")); version (Windows) { // Same as calling globMatch!(CaseSensitive.no)(path, pattern) assert(globMatch("foo", "Foo")); assert(globMatch("Goo.bar", "[fg]???bar")); } version (linux) { // Same as calling globMatch!(CaseSensitive.yes)(path, pattern) assert(!globMatch("foo", "Foo")); assert(!globMatch("Goo.bar", "[fg]???bar")); }
Matches a pattern against a path.
Some characters of pattern have a special meaning (they are meta-characters) and can't be escaped. These are:
Individual characters are compared using filenameCharCmp!cs, where cs is an optional template parameter determining whether the comparison is case sensitive or not. See the filenameCharCmp documentation for details.
Note that directory separators and dots don't stop a meta-character from matching further portions of the path.