Comments (13)
console.log(mm.isMatch('a/b/c/d', 'a/**b')) // => false
It does if you fix the pattern: console.log(mm.isMatch('a/b/c/d', 'a/**d')); // => true
from micromatch.
Hmm, okay. I remember implementing behavior based on my (literal) interpretation of the spec. But it seems this is a bit nuanced.
fwiw I'm refactoring this to use a parser like the one implemented in the refactor branch of extglob. this will allow us to easily make changes based on discussions like this
from micromatch.
Is this intentional?
No, it's not. I'll look into it, thx
from micromatch.
@MartinKolarik returns true (maybe a bug?)
I don't think so. It's not a bug for me.
No, it's not.
@jonschlinkert @MartinKolarik, actually it is logical to be true
because *
means 0 or more
. And no matter that it is globstar
not single star, it still make sense.
from micromatch.
@tunnckoCore it would make sense for mm.isMatch('a/b', 'a/**b');
, but it shouldn't behave like globstar (matching multiple dirs) if it isn't the only thing in a path part.
from micromatch.
I'm not saying it should behave like globstar. I'm not sure for the my last sentence, just saying it make some sense.
And not, it not behaves as globstar, which is good and expected?
console.log(mm.isMatch('a/b/c/d', 'a/**b')) // => false
from micromatch.
The current behavior is correct. From the bash specification
two adjacent ‘’s used as a single pattern will match all files and zero or more directories and subdirectories. If followed by a ‘/’, two adjacent ‘’s will match only directories and subdirectories.
closing
from micromatch.
Well, the linked spec also doesn't say mm.isMatch('a/b/c', 'a/b**');
shouldn't match, but it (I think correctly) doesn't. I wasn't able to find a spec covering this behavior, but it's documented in minimatch's README, and more importantly, it's how real bash works (just tested that).
from micromatch.
fwiw I'm refactoring this to use a parser like the one implemented in the refactor branch of extglob.
Looks good, that should definitely make it easier to handle situations like this.
from micromatch.
indeed, but the best part is that it's also much faster :)
from micromatch.
Really? It already is quite fast. Will definitely take a closer look at the code.
from micromatch.
more specifically it parses and compiles the regex patterns faster. so initialization will be faster, but not necessarily the actual matching. Hmm, I'm going to create an issue to get my thoughts out on this
from micromatch.
more specifically it parses and compiles the regex patterns faster. so initialization will be faster, but not necessarily the actual matching
yeah that makes sense
from micromatch.
Related Issues (20)
- Can't match string with leading dot HOT 3
- extglob Denial of service HOT 4
- Non-filepaths matchs HOT 3
- SyntaxError: Invalid or unexpected token when running from Jest HOT 1
- 'Or' functionality broken (using |)
- Proper docs for windows option??
- Add a way to generate a glob from a file name HOT 1
- Basename breaks matching complex pattern HOT 2
- Will micromatch gradually phase out CJS support instead of abruptly (cf multimatch)? HOT 2
- Documentation incomplete for `scan`
- Alternatives in extglobs not matching correctly? HOT 5
- micromatch('.prettierrc.json', '**/*.json') => false HOT 3
- Image for sponsorships
- [BUG] Vulnerabilities Found in Micromatch and Braces HOT 2
- `micromatch.not` returns nothing if empty pattern list provided
- [BUG] Vulnerabilities Found in Micromatch and Braces HOT 38
- gitIgnore and negation patterns - not following gitIgnore specs HOT 5
- Question: Globstar and trailing slashes
- Inefficient Regular Expression Complexity vulnerability with High severity found HOT 6
- Negation style ignores dot option?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micromatch.