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

[perl #119073] Misbehaving regex

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
July 30, 2013 00:48
Subject:
[perl #119073] Misbehaving regex
Message ID:
rt-3.6.HEAD-2552-1375145291-1854.119073-15-0@perl.org
On Mon Jul 29 10:37:23 2013, nicholas wrote:
> 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
> 

#####
$ ./perl -Ilib -v | head -3 | tail -2This is perl 5, version 19,
subversion 3 (v5.19.3 (v5.19.2-208-g5c24ac0)) built for darwin-2level

$ ./perl -e '"b" =~ /(?1)(?:(b)){0}/; print ">$&<\n";'
>b<
#####

I believe this ticket is closable.  Can someone confirm?

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=119073

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