Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Finding match offsets of named captures in 5.10 regex

by LanX (Saint)
on Jan 30, 2013 at 09:30 UTC ( [id://1016008]=note: print w/replies, xml ) Need Help??


in reply to Finding match offsets of named captures in 5.10 regex

> The following code maps names to numbers if the regex contains only named captures but falls apart if there are named ones too.

> @n{re::regnames(1)} = (1 .. $#+);

No sorry thats wrong, the names come in the wrong order.

DB<108> '1234' =~ /(?<C>1)(?<D>2)(?<B>3)(?<A>4)/;re::regnames(1) => ("A", "D", "C", "B")

Cheers Rolf

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-04-20 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found