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
(Note that this does not have anything to do with the braces library).
From my reading of the code, it seems that there's an intent for braces to support the Kleene star (match zero or more times). In fact, one of the tests for braces is titled "should support Kleene stars" (see https://github.com/micromatch/picomatch/blob/master/test/braces.js#L50-L65). However, the way the tests are written, the assertions are ambiguous. The assertions succeed even if the star is interpreted as a glob.
Here's an example of one of the tests:
assert(isMatch('abcc','{ab,c}*'))
That succeeds not because the pattern is repeated, but because the trailing * matches any characters after the match. To make the test unambiguous, we need a negative assertion.
assert(!isMatch('abcd','{ab,c}*'))
If we examine the regular expression that picomatch generates, we see a discrepancy between a Kleene star and a Kleene plus.
In the latter case, I expect the regular expression to be as follows:
/^(?:(ab|c)*)$/
None of the options I tried seem to affect the result.
I would hope that the Kleene star could be supported for braces. That would make them a parallel alternative to the inverted pattern of the extglob (e.g., *({ab,c})).
(Note that this does not have anything to do with the braces library).
From my reading of the code, it seems that there's an intent for braces to support the Kleene star (match zero or more times). In fact, one of the tests for braces is titled "should support Kleene stars" (see https://github.com/micromatch/picomatch/blob/master/test/braces.js#L50-L65). However, the way the tests are written, the assertions are ambiguous. The assertions succeed even if the star is interpreted as a glob.
Here's an example of one of the tests:
That succeeds not because the pattern is repeated, but because the trailing
*
matches any characters after the match. To make the test unambiguous, we need a negative assertion.If we examine the regular expression that picomatch generates, we see a discrepancy between a Kleene star and a Kleene plus.
In the latter case, I expect the regular expression to be as follows:
/^(?:(ab|c)*)$/
None of the options I tried seem to affect the result.
I would hope that the Kleene star could be supported for braces. That would make them a parallel alternative to the inverted pattern of the extglob (e.g.,
*({ab,c})
).Note that since braces become parens, the intent to support the Kleene star seems to then contradict the following test: https://github.com/micromatch/picomatch/blob/master/test/parens.js#L7-L16
The text was updated successfully, but these errors were encountered: