isaacs / minimatch

a glob matcher in javascript
ISC License
3.3k stars 247 forks source link

Directories can contain square brakets #50

Closed floatdrop closed 2 years ago

floatdrop commented 10 years ago

This is continuation of issue, started in gulp-watch. Minimatch translates [ and ] as class pattern, but in fact you can execute mkdir such[dir] and create folder with name that includes brackets. Seems like minimatch is lacking of ability to escape square brackets, because writing \[ does not help.

yocontra commented 10 years ago

:+1: You should be able to escape any minimatch special characters

tunnckoCore commented 10 years ago

+1 Mm, yea. With single \[ doesn't help, with \\[ also, because splits by \\ for windows paths...

ruifortes commented 10 years ago

+1

phated commented 9 years ago

@isaacs I notice some commits that relate to this. Is it fixed?

tunnckoCore commented 9 years ago

@phated yea, it seems it is fixed and work with double slash for escaping. cuz yesterday i tested it https://github.com/gulpjs/gulp/issues/1027 but yea, some response also would be good.

srcspider commented 9 years ago

@phated assuming this is the same that gulp is currently using; it's not fixed in gulp 3.9.0

phated commented 8 years ago

Sorry, wrong thread :/

ericsciple commented 8 years ago

fyi - i've found [[] works as a substitute for escaping [ on Windows

isaacs commented 2 years ago

In latest 3.0, you can escape and set allowWindowsEscape:true to the options.

In v5 and up, \ is no longer treated as a path separator in patterns, so you must use / in patterns on windows, and can escape to your hearts' delight.