I was trying to make a regex that does not match anything using the [^\w\W] syntax. It worked by itself, but failed to compile once I used a greedy quantifier on it.
I played around some more and the issue appears when using a negated character class like \W or \D inside a negated set that is
quantified with a greedy operator. Lazy and possessive versions compile just fine.
I was trying to make a regex that does not match anything using the
[^\w\W]
syntax. It worked by itself, but failed to compile once I used a greedy quantifier on it.I played around some more and the issue appears when using a negated character class like
\W
or\D
inside a negated set that is quantified with a greedy operator. Lazy and possessive versions compile just fine.Godbolt: https://godbolt.org/z/edKfYeqo9
Here's the error: