develooper Front page | perl.perl5.porters | Postings from December 2004

Re: [perl #32840] $^R value lost in (?:...)? constructs

Thread Previous | Thread Next
From:
David Landgren
Date:
December 5, 2004 03:50
Subject:
Re: [perl #32840] $^R value lost in (?:...)? constructs
Message ID:
41B2F5F6.8040200@landgren.net
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";

David

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