Skip to main content
added 1 character in body
Source Link
Fravadona
  • 1.6k
  • 5
  • 14

In an extglob, !(.min) matches anything that isn't exactly .min (as long it doesn't contain a /), and that includes the empty string!!!

So, when you test foo/bar/baz/test.min.js against the extglob foo/bar/**/*!(.min).js you get a hit because:

  • foo/bar/ matches foo/bar/
  • **/ matches baz/
  • * matches test.min
  • !(.min) matches the empty string
  • .js matches .js

If the meaning that you want from !(.min) is in fact "anything that doesn't end with .min" then, in spoken language, that is the negation of "anything that ends with .min", which (which translates to *.min in glob terms;terms); so you just have to use !(*.min) to fix your issue:

foo/bar/**/!(*.min).js

In an extglob, !(.min) matches anything that isn't exactly .min (as long it doesn't contain a /), and that includes the empty string!!!

So, when you test foo/bar/baz/test.min.js against the extglob foo/bar/**/*!(.min).js you get a hit because:

  • foo/bar/ matches foo/bar/
  • **/ matches baz/
  • * matches test.min
  • !(.min) matches the empty string
  • .js matches .js

If the meaning that you want from !(.min) is in fact "anything that doesn't end with .min" then, in spoken language, that is the negation of "anything that ends with .min", which translates to *.min in glob terms; so you just have to use !(*.min) to fix your issue:

foo/bar/**/!(*.min).js

In an extglob, !(.min) matches anything that isn't exactly .min (as long it doesn't contain a /), and that includes the empty string!!!

So, when you test foo/bar/baz/test.min.js against the extglob foo/bar/**/*!(.min).js you get a hit because:

  • foo/bar/ matches foo/bar/
  • **/ matches baz/
  • * matches test.min
  • !(.min) matches the empty string
  • .js matches .js

If the meaning that you want from !(.min) is in fact "anything that doesn't end with .min" then, in spoken language, that is the negation of "anything that ends with .min" (which translates to *.min in glob terms); so you just have to use !(*.min) to fix your issue:

foo/bar/**/!(*.min).js
added 31 characters in body
Source Link
Fravadona
  • 1.6k
  • 5
  • 14

In an extglob, !(.min) matches everythinganything that isn't exactly .min, as (as long it doesn't contain a /;), and that includes the empty string!!!

So, when you test foo/bar/baz/test.min.js against the globextglob foo/bar/**/*!(.min).js you get a hit because:

  • foo/bar/ matches foo/bar/
  • **/ matches barbaz/
  • * matches test.min
  • !(.min) matches the empty string
  • .js matches .js

If the meaning that you want from !(.min) is in fact "anything that doesn't end with .min", then, in spoken language, that is the negation of "anything that ends with .min" (which is, which translates to *.min in glob terms). So canterms; so you just have to use !(*.min) to fix your issue:

foo/bar/**/!(*.min).js

In an extglob, !(.min) matches everything that isn't exactly .min, as long it doesn't contain a /; that includes the empty string!!

So, when you test foo/bar/baz/test.min.js against the glob foo/bar/**/*!(.min).js you get a hit because:

  • foo/bar/ matches foo/bar/
  • **/ matches bar/
  • * matches test.min
  • !(.min) matches the empty string
  • .js matches .js

If the meaning that you want from !(.min) is in fact "anything that doesn't end with .min", then in spoken language that is the negation of "anything that ends with .min" (which is *.min in glob terms). So can use !(*.min) to fix your issue:

foo/bar/**/!(*.min).js

In an extglob, !(.min) matches anything that isn't exactly .min (as long it doesn't contain a /), and that includes the empty string!!!

So, when you test foo/bar/baz/test.min.js against the extglob foo/bar/**/*!(.min).js you get a hit because:

  • foo/bar/ matches foo/bar/
  • **/ matches baz/
  • * matches test.min
  • !(.min) matches the empty string
  • .js matches .js

If the meaning that you want from !(.min) is in fact "anything that doesn't end with .min" then, in spoken language, that is the negation of "anything that ends with .min", which translates to *.min in glob terms; so you just have to use !(*.min) to fix your issue:

foo/bar/**/!(*.min).js
added 102 characters in body
Source Link
Fravadona
  • 1.6k
  • 5
  • 14

In an extglob, !(.min) can matchmatches everything butthat isn't exactly .min (+ anything that contains, as long it doesn't contain a /); that includes the empty string!!

WhenSo, when you test foo/bar/baz/test.min.js withagainst the glob foo/bar/**/*!(.min).js you get a hit because:

  • foo/bar/ matches foo/bar/
  • **/ matches bar/
  • * matches test.min
  • !(.min) matches the empty stringempty string
  • .js matches .js

If the meaning that you want from !(.min) is in fact "anything that doesn't end with .min", whichthen in spoken language that is the negation of "anything that ends with .min" (which is *.min, then you in glob terms). So can use !(*.min) to fix theyour issue:

foo/bar/**/!(*.min).js

In an extglob, !(.min) can match everything but .min (+ anything that contains a /); that includes the empty string!

When you test foo/bar/baz/test.min.js with the glob foo/bar/**/*!(.min).js you get a hit because:

  • foo/bar/ matches foo/bar/
  • **/ matches bar/
  • * matches test.min
  • !(.min) matches the empty string
  • .js matches .js

If the meaning that you want from !(.min) is in fact "anything that doesn't end with .min", which is the negation of *.min, then you can use !(*.min) to fix the issue:

foo/bar/**/!(*.min).js

In an extglob, !(.min) matches everything that isn't exactly .min, as long it doesn't contain a /; that includes the empty string!!

So, when you test foo/bar/baz/test.min.js against the glob foo/bar/**/*!(.min).js you get a hit because:

  • foo/bar/ matches foo/bar/
  • **/ matches bar/
  • * matches test.min
  • !(.min) matches the empty string
  • .js matches .js

If the meaning that you want from !(.min) is in fact "anything that doesn't end with .min", then in spoken language that is the negation of "anything that ends with .min" (which is *.min in glob terms). So can use !(*.min) to fix your issue:

foo/bar/**/!(*.min).js
added 13 characters in body
Source Link
Fravadona
  • 1.6k
  • 5
  • 14
Loading
deleted 2 characters in body
Source Link
Fravadona
  • 1.6k
  • 5
  • 14
Loading
added 518 characters in body
Source Link
Fravadona
  • 1.6k
  • 5
  • 14
Loading
Source Link
Fravadona
  • 1.6k
  • 5
  • 14
Loading