Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:module': 0.04; 'infinite': 0.07; 'python': 0.08; 'from:addr:python': 0.09; 'loop.': 0.09; 'am,': 0.12; '"$*"': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'reply-to:addr :python-list': 0.16; 'subject: \n ': 0.16; 'url:hg': 0.16; 'weird.': 0.16; 'wrote:': 0.18; 'repeated': 0.18; 'subject:skip:s 10': 0.18; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'assume': 0.22; 'feb': 0.22; 'suite,': 0.23; 'subject: ?': 0.24; 'work.': 0.27; 'producing': 0.28; 'equivalent.': 0.30; 'pattern': 0.30; 'actual': 0.32; 'tue,': 0.32; 'there': 0.33; 'this.': 0.33; 'header:User-Agent:1': 0.33; 'test': 0.34; 'received:84': 0.34; 'crazy': 0.34; 'reply-to:addr:python.org': 0.34; 'stuck': 0.34; 'to:addr:python-list': 0.35; 'however,': 0.35; 'something': 0.35; 'url:python': 0.35; 'combination': 0.37; 'but': 0.37; 'could': 0.38; 'some': 0.38; 'think': 0.38; 'becomes': 0.39; 'url:org': 0.39; 'user': 0.40; 'to:addr:python.org': 0.40; 'engine': 0.65; 'cause': 0.67; 'works,': 0.68; 'header:Reply-To:1': 0.70; 'soon': 0.72; 'reply-to:no real name:2**0': 0.72; '(see:': 0.84; 'anchor': 0.84; 'subject:Nothing': 0.84; 'subject:nothing': 0.84; 'url:lib': 0.84; 'url:test': 0.91; 'realistic': 0.93 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.0 cv=IdEFqBWa c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=FFsdPcU1_MIA:10 a=Uxut_nKmTL0A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=pGLkceISAAAA:8 a=8AHkEIZyAAAA:8 a=fYSzRWyZ4hEaf2IEnNAA:9 a=B-S1EeW1qKIHxUzHE88A:7 a=wPNLvfGTeEIA:10 a=MSl-tDqOz04A:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 X-AUTH: mrabarnett:2500 Date: Tue, 14 Feb 2012 18:05:59 +0000 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1329242751 news.xs4all.nl 6891 [2001:888:2000:d::a6]:40864 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20413 On 14/02/2012 15:53, Devin Jeanpierre wrote: > On Tue, Feb 14, 2012 at 10:05 AM, Vlastimil Brom > wrote: >> However, is there any realistic usecase for repeated zero-width anchors? > > Maybe. There is a repeated zero-width anchor is used in the Python re > test suite, which is what made me notice this. I assume that came from > some actual use-case. (see: > http://hg.python.org/cpython/file/096e856a01aa/Lib/test/test_re.py#l599 > ) > > And yeah, even something as crazy as ()* works, but as soon as it > becomes (a*)* it doesn't work. Weird. > I think it's a combination of warning the user about something that's pointless, as in the case of "$*", and producing a pattern which could cause the internal regex engine to get stuck in an infinite loop. It is inconsistent in that it warns about "$*" but not "(?=$)*" even though they are basically equivalent.