Regex for Python 2.7
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Sat Jan 24 18:23:44 EST 2009
En Sat, 24 Jan 2009 18:23:51 -0200, MRAB <google at mrabarnett.plus.com>
escribió:
> Some time ago I discovered this difference between regular expressions
> in Python and Perl:
>
> Python
>
> \A matches at start of string
> \Z matches at end of string
>
> Perl
>
> \A matches at start of string
> \Z matches before terminal newline or at end of string
> \z matches at end of string
>
> In Perl \A == ^ and \Z == $ in single-string mode, but in Python \A == ^
> and \Z != $ in single-string mode.
Why do you want the two to be equivalent? Isn't a good thing that you have
both alternatives (\Z and $)? Use whichever is adequate in each case.
--
Gabriel Genellina
More information about the Python-list
mailing list