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

Re: [perl #119073] Misbehaving regex

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
July 29, 2013 17:36
Subject:
Re: [perl #119073] Misbehaving regex
Message ID:
20130729173624.GB3729@plum.flirble.org
On Mon, Jul 29, 2013 at 07:18:55PM +0200, demerphq wrote:
> On 29 July 2013 18:26, Philip Hazel <perlbug-followup@perl.org> wrote:

> > $ perl -e '"b" =~ /(?1)(?:(b)){0}/; print ">$&<\n";'
> >><
> >
> > In previous versions of Perl, this would print >b< that is, the regex matched
> > "b", which is what I think it should.
> 
> I think this is fallout from the {0} => NOTHING optimization.  It
> appears this optimization cannot be applied when the patterns are
> recursive.

Yes

Porting/bisect.pl --start=v5.16.0 --end=v5.18.0 --target=miniperl -e '"b" =~ /(?1)(?:(b)){0}/; die ">$&<" unless $& eq "b"'

Broken by 3018b823898645e44b8c37c70ac5c6302b031381

Porting/bisect.pl --expect-fail --start v5.18.0 --target=miniperl -e '"b" =~ /(?1)(?:(b)){0}/; die ">$&<" unless $& eq "b"'

Fixed by 2e3a23da260a7ec5d61b81cb34c38de5e528b41d

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About