anymatch icon indicating copy to clipboard operation
anymatch copied to clipboard

Matchers with an opening parenthesis do not work.

Open george-thomas-hill opened this issue 4 years ago • 1 comments

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.

george-thomas-hill avatar Dec 30 '21 23:12 george-thomas-hill

@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

ifiokjr avatar Jun 07 '22 04:06 ifiokjr