Code Monkey home page Code Monkey logo

extglob's Issues

questionable patterns

While working on the refactor, these were the only patterns where Bash 4.3 disagreed with the results from this library. (fwiw minimatch fails 37 of the these tests).

I believe extglob is correct on most of these - this is only a few patterns with multiple examples for clarity (for example, IMHO !(foo)* should not match foo). I'd like some feedback on what the "verdict" should be.

edited 2016-10-17: most of these now agree. I realized that (in most of the listed cases) Bash is doing a "contains" match versus an "exact" match. Also, fwiw minimatch agrees with extglob on all cases except for the one minimatch fails on (which extglob and bash agree on). Unfortunately I've not been able to identify a specific reason that bash or minimatch disagree with this library on any cases - but it's clear that extglob is much more accurate than minimatch, and it appears that extglob is also more accurate than bash (it's known that bash still fails some edge cases).

String Pattern Bash Extglob Minimatch Agreed?
foo !(foo)* true true true
bar !(foo)* true true true
baz !(foo)* true true true
foobar !(foo)* true true true
foo *(!(foo)) true false true
moo.cow !(*.*).!(*.*) true true true
mad.moo.cow !(*.*).!(*.*) false true true X
foo.js.js *.!(js) true true true
foo.js.js *.!(js)* true false false X
foo.js.js *.!(js)+ false false false
foo.js.js *.!(js)*.!(js) false false false

Notes

One thing to consider is that whereas in bash, the extglob pattern might be the complete pattern, with this library the pattern is more likely to be a part of a larger glob pattern for testing file paths, etc.

cc @phated @doowb @tunnckoCore

!(*.js|*.json) does not match a.js.gz

Hello,

I am using extglob v2.0.2 and node v8.9.0.

As the title states, there is a case where a pattern does not match where I thought it would.

extglob.makeRe("!(*.js|*.json)").test("a.js.gz") === true // KO
extglob.makeRe("!(*.js|*.json)").test("a.json.gz") === true // KO
extglob.makeRe("!(*.js|*.json)").test("a.gz") === true // OK

Should this not match or is it a bug?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.