License:
BSD style: see license.txtVersion:
Dec 2006: Initial release Jan 2009: Replaced normalizeAuthor:
Max Samukha, Thomas Kühne, Grzegorz Adam HankiewiczExamples:
1 | normalize("/home/foo/./bar/../../john/doe"); // => "/home/john/doe" |
* | Matches 0 or more instances of any character. |
? | Matches exactly one instances of any character. |
[chars] | Matches one instance of any character that appears between the brackets. |
[!chars] | Matches one instance of any character that does not appear between the brackets after the exclamation mark. |
Internally individual character comparisons are done calling charMatch(), so its rules apply here too. Note that path separators and dots don't stop a meta-character from matching further portions of the filename.
Returns:
true if pattern matches filename, false otherwise.See Also:
charMatch().Throws:
Nothing.Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | version(Win32) { patternMatch("foo.bar", "*") // => true patternMatch(r"foo/foo\bar", "f*b*r") // => true patternMatch("foo.bar", "f?bar") // => false patternMatch("Goo.bar", "[fg]???bar") // => true patternMatch(r"d:\foo\bar", "d*foo?bar") // => true } version(Posix) { patternMatch("Go*.bar", "[fg]???bar") // => false patternMatch("/foo*home/bar", "?foo*bar") // => true patternMatch("foobar", "foo?bar") // => true } |
Returns:
true if c1 matches c2, false otherwise.Throws:
Nothing.Examples:
1 2 3 4 5 6 7 8 9 10 | version(Win32) { charMatch('a', 'b') // => false charMatch('A', 'a') // => true } version(Posix) { charMatch('a', 'b') // => false charMatch('A', 'a') // => false } |