Problem with regular expression

Dan Schmidt dfan at harmonixmusic.com
Wed Sep 27 10:48:14 EDT 2000


Pieter Claerhout <Pieter_Claerhout at CreoScitex.com> writes:

| 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??

Two things can possibly interpret the backslash: turning your input
into a string and turning that string into a regular expression.  The
raw notation only turns off backslash interpretation in the first
step.

-- 
                 Dan Schmidt | http://www.dfan.org
Honest Bob CD now available! | http://www.dfan.org/honestbob/cd.html



More information about the Python-list mailing list