Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 taking refuge in the Monastery: (4)
As of 2014-09-21 03:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (166 votes), past polls