[Python-Dev] Omission in re.sub? (original) (raw)
MRAB python at mrabarnett.plus.com
Sun Dec 11 21:12:41 CET 2011
- Previous message: [Python-Dev] Adding GNU conditional execution in the Makefile?
- Next message: [Python-Dev] Omission in re.sub?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I've just come across an omission in re.sub which I hadn't noticed before.
In re.sub the replacement string can contain escape sequences, for example:
repr(re.sub(r"x", r"\n", "axb")) "'a\nb'"
However:
repr(re.sub(r"x", r"\x0A", "axb")) "'a\\x0Ab'"
Yes, it doesn't recognise "\xNN".
Is there a reason for this?
The regex module does the same, but is there any objection to me fixing it in the regex module? (I'm thinking about compatibility with re here.)
- Previous message: [Python-Dev] Adding GNU conditional execution in the Makefile?
- Next message: [Python-Dev] Omission in re.sub?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]