Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed5.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'matches': 0.07; 'sep': 0.09; 'cc:addr:python-list': 0.10; ':-)': 0.13; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message- id:@tim.thechases.com': 0.16; 'mine.': 0.16; 're.compile(': 0.16; 'readable': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'wrote:': 0.17; 'tim': 0.18; 'simpler': 0.22; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; '>>>>': 0.29; 'chase': 0.29; 'fri,': 0.30; 'skip:8 10': 0.32; 'mine': 0.35; 'pm,': 0.35; 'subject: (': 0.36; 'far': 0.37; 'subject:: ': 0.38; 'skip:" 10': 0.40; 'subject:-': 0.40; 'subject:, ': 0.61; 'more': 0.63; 'pleased': 0.66; 'received:50.22': 0.84; 'subject:write': 0.84; 'yours': 0.88; 'faster.': 0.91 Date: Fri, 28 Sep 2012 22:42:23 -0500 From: Tim Chase User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16 MIME-Version: 1.0 To: Ian Kelly Subject: Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. References: <5066506D.4020702@tim.thechases.com> <50665A23.1060300@tim.thechases.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Source: X-Source-Args: X-Source-Dir: Cc: 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348890078 news.xs4all.nl 6859 [2001:888:2000:d::a6]:56759 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30463 On 09/28/12 22:25, Ian Kelly wrote: > On Fri, Sep 28, 2012 at 8:17 PM, Tim Chase >>>> On 09/28/12 19:31, iMath wrote: >>>>> write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. >> >> r = re.compile( >> "800-555-1212|" >> "555-1212|" >> r"\(800\) 555-1212" >> ) > > Mine is simpler and faster. > > r = re.compile("") doh! «smacks forehead» Yours is FAR more efficient, and much more readable than mine. iMath's teacher will be pleased :-) -tkc