anymatch
anymatch copied to clipboard
Matchers with an opening parenthesis do not work.
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 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