Re: Trouble with regexes

2005-05-26 Thread Tim Roberts
Fernando Rodriguez <[EMAIL PROTECTED]> wrote: > >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) > >i

Re: Trouble with regexes

2005-05-25 Thread Fredrik Lundh
Fernando Rodriguez wrote: > 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). Unix uses \n and Windows uses \r\n, so matching lone \r isn't going to help you the slighest... (read on

Trouble with regexes

2005-05-25 Thread Fernando Rodriguez
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' -- http: