A bug in Python's regular expression engine?

Neil Cerutti horpner at yahoo.com
Tue Nov 27 10:56:25 EST 2007


On 2007-11-27, Just Another Victim of the Ambient Morality
<ihatespam at hotmail.com> wrote:
>     This won't compile for me:
>
>
> regex = re.compile('(.*\\).*')
>
>     I get the error:
>      sre_constants.error: unbalanced parenthesis

Hint 1: Always assume that errors are in your own code. Blaming
library code and language implementations will get you nowhere
most of the time.

Hint 2: regular expressions and Python strings use the same
escape character.

Hint 3: Consult the Python documentation about raw strings, and
what they are meant for.

-- 
Neil Cerutti



More information about the Python-list mailing list