Problem with regular expression

Emile van Sebille emile at fenx.com
Wed Sep 27 09:02:27 EDT 2000


Because the string must first be evaluated before being
passed to re where it will again be evaluated.  Before I saw
Arpad's reply, my first thought was to try
p=re.compile('[A-Za-z]:\\\\')

HTH

--

Emile van Sebille
emile at fenx.com
-------------------


"Pieter Claerhout" <Pieter_Claerhout at CreoScitex.com> wrote
in message
news:mailman.970056701.6238.python-list at python.org...
> Looks a bit unlogical to me. The rules say that you either
need to escape the backslash or use the raw notation
(according to the docs). Why do I need to both escape the
backslash here and use the raw notation if I want to match a
single backslash??
>
> Pieter
>
> -----Original Message-----
> From: Arpad Kiss [mailto:sekter at matavnet.hu]
> Sent: Wednesday, September 27, 2000 1:29 PM
> To: python-list at python.org
> Subject: Re: Problem with regular expression
>
>
> Hi,
> Try this: p=re.compile(r'[A-Za-z]:\\')
> Arpad
>






More information about the Python-list mailing list