-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Behavior of parenthesis in match #107
Comments
I realize this maybe similar to #104, can someone please confirm? |
This is correct. I believe parentheses are matched as literal characters when no preceded by an extglob charcter ( |
Thank you for the reply @jonschlinkert, but please take a look at the first one, even with negation, the I'm trying to use Picomatch to ignore files before processing other files in a repository (that is do not know what to include, we can only exclude known ones), but as you can see here in the screenshot, it is not recognizing the files at root level when I use I can confirm that problems only occur whenever a double asterisk appears at first position in an expression, so I can only avoid leading **, plus using * to help catch the missing files. |
It might be a bug that Any help from contributors would be appreciated, or I can look into this as soon as I get a chance. Suggestions In the meantime, a couple of suggestions for how you're doing matching: If you're doing to use the same pattern multiple times, use the main function returned by picomatch to create a matcher function instead of calling const isMatch = pm('!(**/*.md...)', { dot: true });
// then
isMatch('abc.md');
isMatch('foo/abc.md'); Instead of using a negative extglob with multiple conditions ( ['!**/*.md', '!**/*.txt', ...]
// or
['!**/*.{md,txt}', ...]
// or
'!**/*.{md,txt,gitignore,licenserc.yaml,codestyle.xml}' |
also, thank you for creating the issue and for helping to figure this out! |
I should thank you, without Picomatch our open-source projects will be wasting a lot of CI time at non-functional file changes. |
Hi community,
I just encountered the following
pm.isMatch("CON.md", "!(**/*.md)",{dot:true}) ? "match" : "no match"
- > returns matchpm.isMatch("CON.md", "!(*.md)",{dot:true}) ? "match" : "no match"
- > returns no matchwithout negation
pm.isMatch("CON.md", "**/*.md",{dot:true}) ? "match" : "no match"
- > returns matchpm.isMatch("CON.md", "(**/*.md)",{dot:true}) ? "match" : "no match"
- > returns no matchWhy is the parenthesis matter? I appreciate some help.
The text was updated successfully, but these errors were encountered: