Confused by slash/escape in regexp

andrew cooke andrew at acooke.org
Mon Apr 12 01:21:46 CEST 2010


On Apr 11, 7:18 pm, Paul McGuire <pt... at austin.rr.com> wrote:
[...]
>
> So I would say the surprise isn't that case 3 didn't match, but that
> case 2 matched.
>
> Unless I just don't get what you were testing, not being an RE wiz.

Case 2 is the regexp engine interpreting escapes that appear as
literal strings.  It's weird, because what's the point of Python would
do it for you anyway, but it seems to be the correct behaviour.

Andrew



More information about the Python-list mailing list