compile-time-regular-expressions
compile-time-regular-expressions copied to clipboard
Possessive qualifier "?+" is not supported.
- Possessive qualifier
"?+"
is not supported. ~2.ctre::range
matches an empty string will cause infinite loop, e.g.,for (auto&& m : ctre::range<"a|(ab)?">("aab"));
~ (moved to issue #222)
Isn't the first one supposed to be +?
?
Why?
They're different things. +? is + but nongreedy (match as few times as possible while still making the overall regex match); ?+ is ? but possessive (match as many times as possible, and never backtrack; if backtracking would be needed, backtrack somewhere earlier in the regex, or just fail).
Splitting this issue into two: https://github.com/hanickadot/compile-time-regular-expressions/issues/222
Sorry, I don't get it. I am saying that ?+
is not supported and it is a possessive qualifier, isn't it? CTRE returns syntax error while compiling, e.g., ?+
.
@heyingge-1560733 the possessive optional added in 2e8aaf2aa09a651a05144da61b7e6c7606dd247c, I originally didn't implement it because I didn't see any usecase for it. But after recent unification of cycles and optionals it makes sense to have it.
@hanickadot I will try later. Thanks!