This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients ezio.melotti, gvanrossum
Date 2008-10-23.04:02:18
SpamBayes Score 0.0066475
Marked as misclassified No
Message-id <1224734539.24.0.343051309866.issue4185@psf.upfronthosting.co.za>
In-reply-to
Content
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:

>>> re.sub('a', r'\\n', 'abba')
'\\nbb\\n'
>>>
History
Date User Action Args
2008-10-23 04:02:19gvanrossumsetrecipients: + gvanrossum, ezio.melotti
2008-10-23 04:02:19gvanrossumsetmessageid: <1224734539.24.0.343051309866.issue4185@psf.upfronthosting.co.za>
2008-10-23 04:02:18gvanrossumlinkissue4185 messages
2008-10-23 04:02:18gvanrossumcreate