Confused by slash/escape in regexp

andrew cooke andrew at acooke.org
Sun Apr 11 19:21:46 EDT 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