[docs] regular expression documentation bug

Georg Brandl georg at python.org
Tue Nov 16 13:44:34 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 15.11.2010 14:03, schrieb Alexandros Marinos:
> In the page http://docs.python.org/library/re.html, section 7.2.1, it says:
> 
> '$'
> Matches the end of the string [...] foo matches both ‘foo’ and
> ‘foobar’, while the regular expression foo$ matches only ‘foo’.
> 
> this last sentence looked odd, so I tried it:
> 
> print re.match('foo$', 'foobar')
> 
> output: "None"
> 
> I think a better example would be something like 'foobarfoo'.

Hi Alexandros,

I'm not sure what you think the bug is here.  Your example shows
that "foo$" does not match "foobar", as expected.

regards,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)

iEYEARECAAYFAkzifLIACgkQN9GcIYhpnLAAPACdEUQVGQh2VQ15+X4PP+BXeRtD
8rwAn0+YvyW/z1a+w1zHUTg+2T+LbtAC
=hJaT
-----END PGP SIGNATURE-----


More information about the docs mailing list