Closed michaelmior closed 4 months ago
Yes, this is deliberate. A regular expression is a concise description of a regular language, which is a set of strings, and greenery
provides tools for manipulating those expressions. However, lazy quantifiers do not alter the regular language. The set of strings matched by /o{0,1}?/
is identical to the set of strings matched by /o{0,1}/
- they describe the same regular language. Lazy quantifiers do affect substring matches, but greenery
does not actually provide matching functionality, that isn't what it's for.
@qntm Got it, thanks for the response. I guess that means it doesn't support lazy/greedy modifiers at all, which makes sense. Although I will say that it would be very helpful for my use case if the parser would accept such regexes anyway. I'm dealing with a scenario where I'd like to be able to handle as broad a set of expressions as possible.
While of course I could find a way to parse the expression using some other method and remove lazy and greedy modifiers before feeding to greenery, it would be nice to be able to skip this step.
There is a small amount of precedent for allowing syntax in the parser even though it doesn't make a material difference. I will consider this.
@qntm Thanks! I appreciate it :)
Also, I apologize that I missed that lack of support for lazy modifiers is explicitly mentioned in the README…
Give greenery-4.2.1
a try.
@qntm Works great! Thanks :)
Greenery doesn't seem to support lazy quantifiers, for example
o{0,1}?
. Currently I run into a parser error.