problem with regex

Rob Wolfe blue99 at interia.pl
Fri Jul 28 08:55:42 EDT 2006


abcd 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.

You should use raw string:

re.compile(r'[A-Za-z]:\\([^/:\*\?"<>\|])*')

Regards,
Rob




More information about the Python-list mailing list