Trouble with regexes

Fernando Rodriguez frr at THOU_SHALL_NOT_SPAMeasyjob.net
Wed May 25 11:57:49 EDT 2005


Hi,

I'm trying to write a regex that matches a \r char if and only if it
is not followed by a \n (I want to translate text files from unix
newlines to windows\dos).

I tried this, but it doesn't work:
p = re.compile(r'(\r)[^\n]', re.IGNORECASE)

it still matches a string such as r'\r\n'




More information about the Python-list mailing list