From d38acd4d895161098f56db846b9044f159cc0768 Mon Sep 17 00:00:00 2001 From: jonschlinkert Date: Wed, 12 Oct 2016 19:06:09 -0400 Subject: [PATCH] docs: add notes about escaping --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index ff5310d..cc7c78f 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ Usage npm install glob-parent --save ``` +**Examples** + ```js var globParent = require('glob-parent'); @@ -31,7 +33,22 @@ globParent('path/**/*'); // 'path' globParent('path/foo/bar.js'); // 'path/foo' globParent('path/foo/'); // 'path/foo' globParent('path/foo'); // 'path' (see issue #3 for details) +``` + +## Escaping + +The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters: +- `?` (question mark) +- `*` (star) +- `[` (opening bracket) +- `]` (closing bracket) + +**Example** + +```js +globParent('foo/[bar]/') // 'foo' +globParent('foo/\\[bar]/') // 'foo/\\[bar]' ``` Change Log