[issue4185] re module treats raw strings as normal strings

2009-01-01 Thread Georg Brandl
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

[issue4185] re module treats raw strings as normal strings

2008-12-10 Thread Martin v. Löwis
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

[issue4185] re module treats raw strings as normal strings

2008-12-10 Thread Guido van Rossum
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

[issue4185] re module treats raw strings as normal strings

2008-12-10 Thread Martin v. Löwis
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

[issue4185] re module treats raw strings as normal strings

2008-11-11 Thread A.M. Kuchling
Changes by A.M. Kuchling [EMAIL PROTECTED]: -- nosy: +akuchling ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4185 ___ ___ Python-bugs-list mailing

[issue4185] re module treats raw strings as normal strings

2008-10-22 Thread Ezio Melotti
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

[issue4185] re module treats raw strings as normal strings

2008-10-22 Thread Guido van Rossum
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:

[issue4185] re module treats raw strings as normal strings

2008-10-22 Thread Ezio Melotti
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