Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ISSUE-160: Why are parentheses match wrong #186

Merged
merged 1 commit into from
May 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,20 @@ fg.sync(['**/*.md'], { ignore: ['**/second/**'] }); // ['first/file.txt']

You have to understand that if you write the pattern to exclude directories, then the directory will not be read under any circumstances.

## Why are parentheses match wrong?

```js
fg.sync(['(special-*file).txt']) // → [] for files: ['(special-*file).txt']
```

Refers to Bash. You need to escape special characters:

```js
fg.sync(['\(special-*file\).txt']) // → ['(special-*file).txt']
```

Read more about [«Matching special characters as literals»](https://github.com/micromatch/picomatch#matching-special-characters-as-literals).

## How to write patterns on Windows?

Always use forward-slashes in glob expressions (patterns and `ignore` option). Use backslashes for escaping characters. With the `cwd` option use a convenient format.
Expand Down