Dave Baggett <jyt...@baggett.org> added the comment: OK, I missed the initial caret in the regex. The mustquote regex is listing everything that needn't be quoted, and then negating. I still think it's wrong, though. According to BNF given in the Formal Syntax section of RFC 3501, you must must quote atom-specials, which are defined thus:
atom-specials = "(" / ")" / "{" / SP / CTL / list-wildcards / quoted-specials / resp-specials list-wildcards = "%" / "*" quoted-specials = DQUOTE / "\" resp-specials = "]" So I think this regex should do it: mustquote = re.compile(r'[()\s%*"]|"{"|"\\"|"\]"') Changing status to bug. ---------- type: feature request -> behavior _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue917120> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com