--- imaputil.py~ 2012-06-02 13:41:46.000000000 +0200 +++ imaputil.py 2013-01-06 23:52:26.992004939 +0100 @@ -23,9 +23,10 @@ # find the first quote in a string quotere = re.compile( - r"""(?P"(?:\\"|[^"])*") # Quote, possibly containing encoded - # quotation mark - \s*(?P.*)$ # Whitespace & remainder of string""", + r"""(?P"[^\"\\]*(?:\\.|[^"\\])*") # Quote, possibly containing + # encoded quotation mark + \s*(?P.*)$ # Whitespace & remainder of string + """, re.VERBOSE) def debug(*args):