[issue46350] re.sub, re.Match.expand, etc doesn't allow x, u, U, or N escapes in the template

Steven D'Aprano report at bugs.python.org
Tue Jan 11 17:21:30 EST 2022


Steven D'Aprano <steve+python at pearwood.info> added the comment:

It is better to raise each issue in its own ticket.

You seem to have three distinct issues here:

- The issue listed in the title, which I don't understand. A demonstration of the issue would be helpful.

- The unrelated(?) issue of bad \N{} escapes, which appears to have nothing to do with regexes, but maybe I'm wrong? In any case, whether this is regular expressions or plain old strings, it seems reasonable to me to limit \N{} to ASCII-only (Unicode guarantees that code point names are ASCII) and some reasonable length. I can't imagine the Unicode consortium ever deciding on a name > 255 characters, it wouldn't be practical.

- The difference in normalisation between group names and identifiers.

----------
nosy: +steven.daprano

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46350>
_______________________________________


More information about the Python-bugs-list mailing list