Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Quantified named captures in 5.10

by halley (Prior)
on Dec 21, 2007 at 13:56 UTC ( #658449=note: print w/ replies, xml ) Need Help??


in reply to Quantified named captures in 5.10

I guess I wouldn't expect the addition of named captures to change how captures work in regexes. Just because the capture variable has a name does not mean that the () or a+ semantics have changed.

The pre-5.10 version looks like this (I've added a term to show the singularness of captures.

my $str = 'Digits: 123689 abc'; if ($str =~ m{Digits: \s* (\d)+ \s+ (\w+) }x) { print 'Digits: ', $1, ' ', $2, $/; } __OUTPUT__ Digits: 9 abc
With the numeric "names" for captures, it seems natural that there's only one slot. Adding a + to the capture does not add more capturing group instances to the system. There's one actual set of parentheses, so there's one actual capture.

--
[ e d @ h a l l e y . c c ]


Comment on Re: Quantified named captures in 5.10
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-11-21 03:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (104 votes), past polls