-
-
Notifications
You must be signed in to change notification settings - Fork 276
Open
Description
I ran into this problem and it seems i am not the only one struggling with it, I even found another issue for it: 124.
But since I am using v10.0.3, and the hash in that issue points to changes already in master I thought it would be best to create a new issue.
This is reproduce code:
const myFilePath = 'some-directory1/some-directory2/some-directory3/base.xsl';
const myGlob = 'some-directory1/**/some-directory2/**/*.xsl';
console.log('Check 1: ', minimatch(myFilePath, myGlob));
const myGlobRegex1 = new Minimatch(myGlob, { matchBase: false, nocase: true } as MinimatchOptions).makeRe();
const myGlobRegex2 = new Minimatch(myGlob, { matchBase: true, nocase: true } as MinimatchOptions).makeRe();
console.log('Check 2: ', myGlobRegex1 ? myGlobRegex1.test(myFilePath) : 'illegal regex');
console.log('Check 3: ', myGlobRegex2 ? myGlobRegex2.test(myFilePath) : 'illegal regex');
And the output is:
Check 1: true
Check 2: false
Check 3: false
For completeness sake, I added matchBase, but that does not seem to matter. Value of regex's are:
myGlobRegex1: /^some\-directory1(?:\/|\/(?:(?!(?:\/|^)\.).)*?\/)some\-directory2\/(?!\.)[^/]*?\.xsl$/i
myGlobRegex2: /^some\-directory1(?:\/|\/(?:(?!(?:\/|^)\.).)*?\/)some\-directory2\/(?!\.)[^/]*?\.xsl$/i
Note that some-directory{n}
means a directory name, not some path.
Metadata
Metadata
Assignees
Labels
No labels