diff --git a/README.md b/README.md index 2e9bd0f..33ede1d 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,12 @@ minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a ``` +### allowWindowsEscape + +Windows path separator `\` is by default converted to `/`, which +prohibits the usage of `\` as a escape character. This flag skips that +behavior and allows using the escape character. + ## Comparisons to other fnmatch/glob implementations While strict compliance with the existing standards is a worthwhile diff --git a/minimatch.js b/minimatch.js index 90eacf6..e07c58f 100644 --- a/minimatch.js +++ b/minimatch.js @@ -135,7 +135,7 @@ function Minimatch (pattern, options) { if (!options) options = {} // windows support: need to use /, not \ - if (path.sep !== '/') { + if (!options.allowWindowsEscape && path.sep !== '/') { pattern = pattern.split(path.sep).join('/') }