Boy do REs ever suck sometimes...

Carsten Gaebler clpy at snakefarm.org
Fri Oct 5 16:48:16 CEST 2001


Richard Jones wrote:

> Hrm - perhaps the ref could have a note in it to explain that "$" will do
> some sort of automagic lookahead for a newline, and that if you don't want
> that, then use '\Z'?

The truth, the whole truth and nothing but the truth about "$" is
hidden in
http://www.python.org/doc/current/lib/Contents_of_Module_re.html
under "MULTILINE":

'By default, "^" matches only at the beginning of the string, and
"$" only at the end of the string and immediately before the
newline (if any) at the end of the string.'

Perhaps this should be moved to some more visible place?

cg.



More information about the Python-list mailing list