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


Groups > comp.lang.python > #74126

Re: Question about metacharacter '*'

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'mrab': 0.05; 'matches': 0.07; 'subject:Question': 0.07; 'matched': 0.09; '(0,': 0.16; '460': 0.16; 'subject:skip:m 10': 0.16; 'unicode.': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'skip:u 20': 0.35; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'more': 0.64; 'jul': 0.74
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=zQt6dPgQUc2oRXKuGfavTkjx9U6x7oeMs8N8+3IqTDg=; b=WX/RtD4mGIOnkANHbnq8LDMZKdRFSw+/kncwew5d4T1TKm5wKDCr8UjZ8jTUyhTeDy wjfjRCT2FsUHWewaMMCuW9qSnF3fK3cqm/3Yv430o/pVqI7ikRh59fAmqakL6sqpbzV6 l3cdSyTXbeqeM+dsVUhoSUT+oUUU36r//XPoGY0z1scnDXSwiFfxra0uUjgN7z4nyqZX cbOxLW2ZY293s+TEeyyiC7Aiwd3ie2ka9AQ+GL2mq1IPWFLb2NyvGajMjok/hStAP+zN /yetGzJNuBiYhEfVAurXNWEXsnPQ9EXH3f4VTHu4kPV7gDu10hXEYohj/SHzhRhcA2ch hjBA==
X-Received by 10.70.98.167 with SMTP id ej7mr16812pdb.70.1404752784974; Mon, 07 Jul 2014 10:06:24 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <53B9D273.1060706@mrabarnett.plus.com>
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 Mon, 7 Jul 2014 11:05:44 -0600
Subject Re: Question about metacharacter '*'
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11602.1404752788.18130.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1404752788 news.xs4all.nl 2927 [2001:888:2000:d::a6]:43331
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:74126

Show key headers only | View raw


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


Thread

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

csiph-web