problem with regex

Barry barrynyc at gmail.com
Fri Jul 28 08:56:41 EDT 2006


On 28 Jul 2006 05:45:05 -0700, abcd <codecraig at gmail.com> wrote:
> I have a regex: '[A-Za-z]:\\([^/:\*\?"<>\|])*'
>
> when I do, re.compile('[A-Za-z]:\\([^/:\*\?"<>\|])*') ...I get
>
> sre_constants.error: unbalanced parenthesis
>
> do i need to escape something else?  i see that i have matching
> parenthesis.
>
> thx
>
> --

Try making the argument a raw string:
re.compile(r'[A-Za-z]:\\([^/:\*\?"<>\|])*')



More information about the Python-list mailing list