Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: 5.10 named capture in DEFINE regex

by brian_d_foy (Abbot)
on Dec 27, 2007 at 17:58 UTC ( #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


Comment on Re: 5.10 named capture in DEFINE regex
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (16)
As of 2015-08-03 14:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (39 votes), past polls