Georg Brandl ge...@python.org added the comment:
Added a bit to the re.sub(n) docstrings in r68118.
--
nosy: +georg.brandl
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4185
Martin v. Löwis [EMAIL PROTECTED] added the comment:
IIUC, there is no proposed patch yet, so this is out of scope for 2.5.3.
--
nosy: +loewis
versions: -Python 2.5.3
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4185
Guido van Rossum [EMAIL PROTECTED] added the comment:
Eh? It's just a doc bug now.
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4185
___
___
Python-bugs-list
Martin v. Löwis [EMAIL PROTECTED] added the comment:
Eh? It's just a doc bug now.
[assuming you are wondering why it is out of scope for 2.5.3]
I don't understand the actual issue (and don't have time to find out
what it is), so somebody else would have to provide a patch. Since there
is no
Changes by A.M. Kuchling [EMAIL PROTECTED]:
--
nosy: +akuchling
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4185
___
___
Python-bugs-list mailing
New submission from Ezio Melotti [EMAIL PROTECTED]:
The re module seems to treat the raw strings as normal strings:
'a1a1a'.replace('1', r'\n') == re.sub('1', r'\n', 'a1a1a')
False
'a1a1a'.replace('1', '\n') == re.sub('1', r'\n', 'a1a1a')
True
In the first line str.replace and re.sub should
Guido van Rossum [EMAIL PROTECTED] added the comment:
No, re.sub()'s documentation
(http://docs.python.org/library/re.html#re.sub)
makes it clear that \ followed by n in the replacement string is
interpreted.
To insert \ followed by n you have to double the \ inside the raw string
like this:
Ezio Melotti [EMAIL PROTECTED] added the comment:
My bad, I only checked with help(re.sub).
In the examples with re.search I was indeed wrong because I forgot to
escape the \ and for the regex engine \n is the same of n (whereas \\n
is a literal \ followed by n), but I expected