Code Monkey home page Code Monkey logo

Comments (10)

jonschlinkert avatar jonschlinkert commented on June 12, 2024 1

hm... what about opposite

I'm running all of the Bash tests I was able to find - the table above lists the only patterns that extglob disagrees with bash on. Unfortunately the nuances of bash extglob don't seem to be consistent with regex - unless we can find a real specification, with sufficient detail to determine correct matching behavior, we'll just have to go with our best guess on some of these.

from extglob.

phated avatar phated commented on June 12, 2024 1

I think I am pretty much agreement with everyone. extglob's behavior seems to be less surprising. Make sure to note the differences in the readme, of course.

from extglob.

jonschlinkert avatar jonschlinkert commented on June 12, 2024 1

Make sure to note the differences in the readme, of course

good call. I might have forgotten to do that thx

from extglob.

tunnckoCore avatar tunnckoCore commented on June 12, 2024

moo.cow !(*.*).!(*.*)

I'm agree with Bash to be true, it make sense.

foo.js.js *.!(js)

and

foo.js.js *.!(js)*

I'm agree with Bash and seeing his the point to return true, but I'm curious what Bash says for *.!(js.)?

edit: maybe outer have precedence than inner here

foo *(!(foo))

hm... what about opposite: !(*(foo))?

In most cases I'm agree with extglob lib more than Bash.

from extglob.

es128 avatar es128 commented on June 12, 2024

The patterns themselves are pretty bizarre and basically contradict themselves. Based on the chart I'd think extglob's behavior is more in line with what users would expect if they actually used these sorts of combinations, and I also think that when the pattern is odd/ambiguous it's better to "fail closed" and lean toward false when in doubt - so extglob still wins.

I suppose I could understand Bash's reasoning on some of these - particularly those with a trailing * (but at that point should a trailing * just trump absolutely anything else specified in the pattern?) - but a few I'm really struggling to understand how a match could be considered correct behavior.

Stellar work here @jonschlinkert

from extglob.

jonschlinkert avatar jonschlinkert commented on June 12, 2024

thanks for the feedback @es128!

I also think that when the pattern is odd/ambiguous it's better to "fail closed" and lean toward false when in doubt

yeah that's pretty similar to what I was thinking

from extglob.

tunnckoCore avatar tunnckoCore commented on June 12, 2024

Yea, why not? Let's go with that agreement and if there so many users that are surprised in future, things can be done more strict and to stick more to Bash.

extglob's behavior is more in line with what users would expect if they actually used these sorts of combinations

Absolutely.

from extglob.

jonschlinkert avatar jonschlinkert commented on June 12, 2024

meaning you agree?

from extglob.

tunnckoCore avatar tunnckoCore commented on June 12, 2024

Yep, I don't have problems with most of them.

from extglob.

jonschlinkert avatar jonschlinkert commented on June 12, 2024

closing, I think this is resolved

from extglob.

Related Issues (6)

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.