-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Ability to split patterns into segments #165
Comments
Of course! you can here anytime. I'll look at the related issue and play around with it and let you know what I come up with. |
@mrmlnc it looks like fast-glob 2.2.7 is published to npm as the The parser in micromatch v4.0 can split the pattern the way you want to (assuming I understand you correctly). |
I think you mean:
Isn't that correct? Meaning, I think the bug is that fast-glob actually is matching I might be confused, thanks for being patient with me. |
Yeap, fast-glob@2.2.7 shipped with micromatch@3. The You say that micromatch@4 can split the pattern into segments? How I can do it? I must use the To clarify. I want split the pattern Pattern:
For more complex example you can check the https://github.com/isaacs/node-glob/blob/master/sync.js Example with minimatchconst { Minimatch } = require('minimatch');
const pattern = new Minimatch('root/+(dir1|dir2)/one/**/*');
console.dir(pattern, { colors: true }); Minimatch {
options: {},
set: [
[
'root',
/^(?!\.)(?=.)(?:dir1|dir2)+$/,
'one',
{},
/^(?!\.)(?=.)[^\/]*?$/
]
],
pattern: 'root/+(dir1|dir2)/one/**/*',
regexp: null,
negate: false,
comment: false,
empty: false,
globSet: [ 'root/+(dir1|dir2)/one/**/*' ],
globParts: [ [ 'root', '+(dir1|dir2)', 'one', '**', '*' ] ]
} |
Oh man, I'm sorry I forgot that I haven't published that code yet. I was thinking it was in 2.0. Let me push it up to a branch on picomatch, and if you have a chance let me know if it does what you need. |
@mrmlnc I just pushed up https://github.com/micromatch/picomatch/tree/dev, but it doesn't have the feature you're looking for. I can't find it! @doowb, do you remember where that logic was that I showed you for splitting globs? edit: nvm, I remember where it is... I'll see how long it will take me to get it integrated into the dev branch. |
Okay, I updated the branch with the code I was working on for splitting globs. Sorry, it's not ready to release, but you can see that I was working on several different approaches to try to get it right. If you want to play around with them and give me feedback that would be great. If not, no worries, I just try to get something published soon either way. |
I'm glad you found it because this is an awesome feature. |
Hi, @jonschlinkert,
I don't know how correct it is to talk about this, so I think we should take this issue as a question.
I need to split the pattern into segments by slashes (not a
maybe_slash
). This is necessary in order to check whether the first part of the path matches the pattern or not. To decide whether to read this directory or not.In the following example we should match the
root/dir1
directory and shouldn't theroot/dir2
:But I cannot apply the pattern to
root/dir1
orroot/dir2
entry, because the pattern expectsone
afterroot/dir1
and will always returnfalse
.Maybe you have some ideas?
Related to mrmlnc/fast-glob#156.
The text was updated successfully, but these errors were encountered: