A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-December/114903.html below:

[Python-Dev] Omission in re.sub?

[Python-Dev] Omission in re.sub? [Python-Dev] Omission in re.sub?MRAB python at mrabarnett.plus.com
Sun Dec 11 21:12:41 CET 2011
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.)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4