You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm doing some generative tests using minimatch as a gold standard, and ran into one niche issue that seems to be a bug with minimatch:
> require('minimatch').makeRe('/*(?)').test('/ok')
true ✅
> require('minimatch').makeRe('/*(?)').test('/ok.txt')
false ❌ I would expect this to also be true
I'm interpreting *(?) in this situation as
0 or more occurrences of any character except slash, failing if the first character is a dot
The compiled regex is
/^\/(?:(?!\.)[^/])*$/
but i think that star should be nudged over into the parens
/^\/(?:(?!\.)[^/]*)$/
The text was updated successfully, but these errors were encountered:
Hm, yes, the generated regexp is noting that the ? is matching the first item in a path portion, and thus disallowing a dot. However, it needs to treat that as effectively (not a dot)(anything)* in repeated cases.
Putting the * inside the paren would fix it in this specific case, but the paren in question corresponds to the ) in *(...|...), and the dot prevention needs to be attached to the sub-pattern, to support stuff like ?(*|.a) where one allows dots and another doesn't.
I'm doing some generative tests using minimatch as a gold standard, and ran into one niche issue that seems to be a bug with minimatch:
I'm interpreting
*(?)
in this situation asThe compiled regex is
/^\/(?:(?!\.)[^/])*$/
but i think that star should be nudged over into the parens
/^\/(?:(?!\.)[^/]*)$/
The text was updated successfully, but these errors were encountered: