regex for replacing \r\n

abcd codecraig at gmail.com
Mon Aug 7 08:14:47 EDT 2006


I am trying to get a regex that will match \r\n in a string.
ultimately i am trying to replace all \r\n with somethign else, say
BLAH.

For example:
This is a message
on a new line

would become:
This is a messageBLAHon a new line.

any ideas?  i tried

re.compile('\r\n').match("This is a message" + os.linesep + "on a new
line") ....but no match.  And I am on windows, so os.linesep gives
'\r\n'

thanks




More information about the Python-list mailing list