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


Groups > comp.lang.python > #20413 > unrolled thread

Re: re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ?

Started byMRAB <python@mrabarnett.plus.com>
First post2012-02-14 18:05 +0000
Last post2012-02-14 18:05 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ? MRAB <python@mrabarnett.plus.com> - 2012-02-14 18:05 +0000

#20413 — Re: re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ?

FromMRAB <python@mrabarnett.plus.com>
Date2012-02-14 18:05 +0000
SubjectRe: re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ?
Message-ID<mailman.5808.1329242751.27778.python-list@python.org>
On 14/02/2012 15:53, Devin Jeanpierre wrote:
> On Tue, Feb 14, 2012 at 10:05 AM, Vlastimil Brom
> <vlastimil.brom@gmail.com>  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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web