The code to parse \N has some lookahead to check whether there's a following quantifier.
This lookahead should not occur inside a character class, or a substitution string, because there are no quantifiers in those contexts.
This commit does not affect whether a string is a valid pattern; it only affects the error which is reported.
Currently, for [\N{4}] the error that's reported is \N is not allowed inside a character class. However, it's not a \N in this context, it's actually a \N{...}.
The error in this context (in my opinion) should be that \N{name} is not supported, because the quantifier parser shouldn't be consulted inside character classes.
The code to parse
\N
has some lookahead to check whether there's a following quantifier.This lookahead should not occur inside a character class, or a substitution string, because there are no quantifiers in those contexts.
This commit does not affect whether a string is a valid pattern; it only affects the error which is reported.
[\N{4}]
the error that's reported is \N is not allowed inside a character class. However, it's not a\N
in this context, it's actually a\N{...}
.\N{name}
is not supported, because the quantifier parser shouldn't be consulted inside character classes.