This commit is contained in:
jonschlinkert 2016-09-03 14:29:08 -04:00
parent 2f993202b5
commit 733822f4af
2 changed files with 7 additions and 1 deletions

View file

@ -11,7 +11,7 @@ module.exports = function isExtglob(str) {
}
var m, matches = [];
while ((m = /(\\).|([@?!+*]\()/g.exec(str))) {
while ((m = /(\\).|([@?!+*]\(.*\))/g.exec(str))) {
if (m[2]) matches.push(m[2]);
str = str.slice(m.index + m[0].length);
}

View file

@ -31,6 +31,12 @@ describe('isExtglob', function () {
});
it('should not match escaped extglobs', function () {
assert(!isExtglob('?(abc/xyz'));
assert(!isExtglob('@(abc'));
assert(!isExtglob('!(abc'));
assert(!isExtglob('*(abc'));
assert(!isExtglob('+(abc'));
assert(!isExtglob('(a|b'));
assert(!isExtglob('\\?(abc)'));
assert(!isExtglob('\\@(abc)'));
assert(!isExtglob('\\!(abc)'));