Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Matchers with an opening parenthesis do not work. #45

Open
george-thomas-hill opened this issue Dec 30, 2021 · 1 comment
Open

Matchers with an opening parenthesis do not work. #45

george-thomas-hill opened this issue Dec 30, 2021 · 1 comment

Comments

@george-thomas-hill
Copy link

george-thomas-hill commented Dec 30, 2021

Matchers with an opening parenthesis do not work.

const anymatch = require('anymatch');

console.log(anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js')); // true

console.log(anymatch('**/node_modules(/**', '/absolute/path/to/node_modules(/somelib/index.js')); // I expect true but get false.

The only difference between the two anymatch() calls is that I added an opening parenthesis after "node_modules".

I have tried escaping the opening parenthesis with a \, but that didn't help.

@ifiokjr
Copy link

ifiokjr commented Jun 7, 2022

@george-thomas-hill you would need to use \\ to escape the bracket.

The following works:

console.log(
  anymatch(
    '**/node_modules\\(/**', 
    '/absolute/path/to/node_modules(/somelib/index.js'
  )
); // => true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants