Description
Hi there,
this is a kind of mix between question and feature request.
I'm interested in a regex feature called possessive quantifiers. In short, these allow you to use the quantifiers *+
, ++
and ?+
. These act like their counterparts (*
, +
, ?
) except that if a match was found, they will not backtrack. as an example, the pattern a?+a
will not match the string a
because the regex engine doesn't backtrack "out of" the first a?
. kind of like a super-greedy match
python supports these starting with 3.11, but some of us are stuck on lower versions (3.9 in my case).
Is there an easy way to make the pattern
property (or the keys of patternProperties
) use the regex
library instead of the builtin re
? It's compatible with the builtin, but has some additional backported features like possessive quantifiers.
Ideally, I'd like some kind of optional argument where I can enable the 3rd party module and make python-jsonschema use that instead of the builtin. I don't think that should be the default, as you probably don't want "useless" extra dependencies.
Alternatively, patching this myself at runtime is probably possible, but it's not going to be pretty. If that's your recommendation, any hints about where to patch it?
As a final option, there are ways to mimic the behavior of possessive quantifiers with existing regex features, but that's not pretty either.