Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: 5.10 named capture in DEFINE regex

by brian_d_foy (Abbot)
on Dec 27, 2007 at 17:58 UTC ( [id://659225]=note: print w/replies, xml ) Need Help??


in reply to 5.10 named capture in DEFINE regex

The results of captures inside the recursion aren't available outside the recursion. See the last paragraph for the DEFINE in perlre. %- will have keys for the names of the bits in DEFINE, but their values will always be undef.

You need to capture the parts you want and name them yourself (similar to the example in perlre):

my $number_re = qr{ (?(DEFINE) (?<int_pat> \d+ ) ) (?<int>(?&int_pat)) }x;
--
brian d foy <brian@stonehenge.com>
Subscribe to The Perl Review

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://659225]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-18 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found