[issue6561] Regex '\d' should not match unicode category 'No'.

Mark Dickinson report at bugs.python.org
Tue Jul 28 19:23:41 CEST 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

[ezio.melotti]
> I suggest something like:
> Matches the decimal digits ``[0-9]`` and all the characters that belong
> to the Unicode category Nd (Number, Decimal Digit).

Hmm.  I don't like this because it suggests (to me) that the characters 
[0-9] don't belong to category [Nd].  I agree the previous version was 
clunky, though.  I've shortened it some;  if anyone else wants to work on 
the wording please feel free.  It might be nice to annotate each of these 
character classes (\w, \s) with the Unicode character categories that they 
correspond to.

> Two more minor details: instead of '\d', I'd use '^\d$' and instead of
> self.assertEqual(re.match('\d', x), None)
> self.assertIsNone(re.match('\d', x)).

Thanks.  Changes applied.

Committed to py3k, r74237.   Leaving open for backport to trunk.

----------
stage: patch review -> committed/rejected
versions:  -Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6561>
_______________________________________


More information about the Python-bugs-list mailing list