develooper Front page | perl.perl5.porters | Postings from July 2013

Re: [perl #119075] Regex inconsistency

Thread Previous | Thread Next
Nicholas Clark
July 29, 2013 18:09
Re: [perl #119075] Regex inconsistency
Message ID:
On Mon, Jul 29, 2013 at 07:21:09PM +0200, demerphq wrote:
> On 29 July 2013 18:34, Philip Hazel <> wrote:

> > $ perl -e '/a{0}?/'
> > Quantifier follows nothing in regex; marked by <-- HERE in m/a{0}? <-- HERE /
> > at -e line 1.
> >
> > I know this is a pathological case, but Perl used to accept it. It is
> > quite happy as long as the quantifier is not zero.
> More {0} => NOTHING fallout, but I *think* this is fixed already.

Porting/ --start=v5.16.0 --end=v5.18.0 --target=miniperl -e '/a{0}?/'

broken by 3018b823898645e44b8c37c70ac5c6302b031381

Porting/ --expect-fail --start v5.18.0 --target=miniperl -e '/a{0}?/'

fixed in blead by c37d14f947f7998211b0455e453160fb7e15b22e

commit c37d14f947f7998211b0455e453160fb7e15b22e
Author: Karl Williamson <>
Date:   Mon Jun 10 20:07:14 2013 -0600

    Quantifier follows nothing in regex
    This changes the code so that any '?' immediately (subject to /x rules)
    following a {0} quantifier is absorbed immediately as part of that
    quantifier.  This allows the optimization to NOTHING to work for
    non-greedy matches.
    Thanks to Yves Orton for doing most of the leg work on this

fixed in maint-5.18 by


    Fix regex seqfault 5.18 regression

according to

Porting/ --expect-fail --start v5.18.0 --end 9de5f9548e6b2b322163ba0386f30c853d6111e2 --target=miniperl -e '/a{0}?/'

Was there an existing ticket in RT for the fixed bug? It would be good to
hang all these tickets off a ticket (or merge them?)

Also, presumably we should add Philip Hazel's test cases as regression tests.

Nicholas Clark

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About