Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.058 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'mrab': 0.05; 'matches': 0.07; 'subject:Question': 0.07; 'cc:addr:python-list': 0.11; 'subject:skip:m 10': 0.16; 'unicode.': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'affects': 0.24; 'tend': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; '>>>>': 0.31; 'equivalent.': 0.31; 'url:python': 0.33; 'johnson': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'two': 0.37; 'expressed': 0.37; 'pm,': 0.38; 'aside': 0.39; 'url:mail': 0.40; 'even': 0.60; 'utilize': 0.61; 'new': 0.61; 'more': 0.64; 'jul': 0.74; 'article': 0.77; 'technically': 0.84; 'rick': 0.93 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 :cc:content-type; bh=Y40F4AWlUlIJb+ZrKTb3tyyRi8NOUoVycCIx3AqBrnE=; b=PZLQXA3VVLXNg+gYdE/cf8onMUtW68MSbpIoMkTfphVDCYorqZmjdyb2CTtc5yKstk aA4JmNnHZml2HCGCs8ufTY3ShqnsplX5TTzx3vImnwK2sSDcfRqvTc8Bg8CDHWv+C9Re zghVyuX8y9q2pDEIhW83bIQ7b3Uy02/vE6+ljxW3dh5fGl0dDStIykMF3y+uEOcD47YX 15q+CIDKcQd2HSX75KxTbHMJG8dckhPtth2dD20YGtkdVi0wPvMP+lmqRRA5d9aRPPc7 WjmuGb0GPgi1wBBRGEnsz9EsVa6ldOvf6KRKu0BduudSRFK3gxltxvPN3BsyiWcLhSKo e+lg== X-Received: by 10.229.204.200 with SMTP id fn8mr41259840qcb.14.1404693638522; Sun, 06 Jul 2014 17:40:38 -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: Devin Jeanpierre Date: Sun, 6 Jul 2014 17:39:57 -0700 Subject: Re: Question about metacharacter '*' To: MRAB Content-Type: text/plain; charset=UTF-8 Cc: "comp.lang.python" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404693646 news.xs4all.nl 2869 [2001:888:2000:d::a6]:55284 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74063 The reason I did not use \d\d* or \d+ or ^\d+$ or any number of more-correct things was because the OP was new to regexps. -- Devin On Sun, Jul 6, 2014 at 3:49 PM, MRAB wrote: > On 2014-07-06 18:41, Albert-Jan Roskam wrote: >> >> >> >> >>> In article , >>> Rick Johnson wrote: >>> >>>> As an aside i prefer to only utilize a "character set" when >>>> nothing else will suffice. And in this case r"[0-9][0-9]*" >>>> can be expressed just as correctly (and less noisy IMHO) as >>>> r"\d\d*". >>> >>> >>> Even better, r"\d+" >> >> >> I tend tot do that too, even though technically the two are not perfectly >> equivalent. With the re.LOCALE flag LC_ctype is also affected, which affects >> what is captured by \d but not by [0-9] >> > \d also matches more than just [0-9] in Unicode. > > -- > https://mail.python.org/mailman/listinfo/python-list