Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74126 > unrolled thread

Re: Question about metacharacter '*'

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2014-07-07 11:05 -0600
Last post2014-07-07 11:05 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Question about metacharacter '*' Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-07 11:05 -0600

#74126 — Re: Question about metacharacter '*'

FromIan Kelly <ian.g.kelly@gmail.com>
Date2014-07-07 11:05 -0600
SubjectRe: Question about metacharacter '*'
Message-ID<mailman.11602.1404752788.18130.python-list@python.org>
On Sun, Jul 6, 2014 at 4:49 PM, MRAB <python@mrabarnett.plus.com> wrote:
> \d also matches more than just [0-9] in Unicode.

I think that anything matched by \d will also be accepted by int().

>>> decimals = [c for c in (chr(i) for i in range(17 * 2**16)) if unicodedata.category(c) == 'Nd']
>>> len(decimals)
460
>>> re.match(r'\d*', ''.join(decimals)).span()
(0, 460)
>>> int(''.join(decimals))
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
>>> nondecimals = [c for c in (chr(i) for i in range(17 * 2**16)) if unicodedata.category(c) in 'NoNl']
>>> len(nondecimals)
688
>>> re.findall(r'\d', ''.join(nondecimals))
[]

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web