Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74126
| References | <1404668474.56075.BPMail_high_noncarrier@web163802.mail.gq1.yahoo.com> <53B9D273.1060706@mrabarnett.plus.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2014-07-07 11:05 -0600 |
| Subject | Re: Question about metacharacter '*' |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11602.1404752788.18130.python-list@python.org> (permalink) |
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))
[]
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Question about metacharacter '*' Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-07 11:05 -0600
csiph-web