[docs] possible bug in regular expression documentation

Georg Brandl georg at python.org
Sun Oct 6 11:05:15 CEST 2013


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

Am 02.08.2013 12:06, schrieb Bart Aelterman:
> Dear,
> 
> While reading the python documentation, chapter 7.2 "Regular expression 
> operations", I noticed a sentence that could be experienced as confusing:
> 
> " \d When the UNICODE flag is not specified, matches any decimal digit;
> this is equivalent to the set [0-9]. With UNICODE, it will match whatever
> is classified as a decimal digit in the Unicode character properties
> database. "
> 
> I have a problem with "decimal digit". These patterns match only one
> character. Therefore, one character can never be decimal, as that would
> imply the presence of at least one digit and a decimal character (dot). I
> would propose to delete the word "decimal". \d matches a digit. Unless you
> want to say that \d+ matches a decimal digit, for instance "2.2". But when
> I try that in ipython, \d+ only matches "2".

Hi Bart,

in this case "decimal" means a digit from the base-10 system, to
differentiate from digits from other number systems that may indicate
values of 10, 11 etc.

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

iEYEARECAAYFAlJRJ8sACgkQN9GcIYhpnLDeHQCgrkT2CnWuLOO/7x3jaZBOSf9z
x8oAoJKllr7HMK8oWJwtFPKv9ysLfv3c
=eXu5
-----END PGP SIGNATURE-----


More information about the docs mailing list