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
|
---|
In Section
Seekers of Perl Wisdom