develooper Front page | perl.perl5.porters | Postings from November 2006

[perl #36909] $^R undefined on matches involving backreferences

Thread Previous
From:
yves orton via RT
Date:
November 18, 2006 05:04
Subject:
[perl #36909] $^R undefined on matches involving backreferences
Message ID:
rt-3.5.HEAD-32138-1163855041-1632.36909-15-0@perl.org
On Sun Dec 05 03:50:40 2004, david@landgren.net wrote:
> david@landgren.net (via RT) wrote:
> > # New Ticket Created by  david@landgren.net 
> > # Please include the string:  [perl #32840]
> > # in the subject line of all future correspondence about this issue. 
> > # <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=32840 >
> > 
> [...]
> > 
> > There do not appear to be any tests that check how $^R should
> > behave. The following file is an attempt to improve matters.
> 
> Late night bad wording. There are indeed tests for $^R in t/op/pat.t but 
> they don't exercise patterns with groupings.
> 
> Playing around some more, the following match, but $^R does not contain 
> what is expected:
> 
> $^R = undef;
> ok( 'ac' =~ /^a(?{30})(?:b(?{31})|c(?{32}))?/, 'ac =~ a(?:b|c)?' );
> ok( $^R == 32, '$^R == 32' );
> 
> $^R = undef;
> ok( 'abbb' =~ /^a(?{36})(?:b(?{37})|c(?{38}))+/, 'abbbb =~ a(?:b|c)+' );
> ok( $^R == 37, '$^R == 37' ) or print "# \$^R=$^R\n";

This bug has been merged with 36909, and has been resolved by patch
#29308. The underlying issue was that CURLYX operands did a regcpblow()
without taking measures to preserve $^R.

The attached patch updates the tests in t/op/rxcode.t to remove todo's
and add additional tests from your ticket.

Cheers,
Yves

Thread Previous


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