http://www.perlmonks.org?node_id=714060


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

Every named capture is numbered as well. So if you have a capture called 'foo', and it's the third capture, you find the offsets in $- [2] and $+ [2]. There isn't a hash with the indexes.

Replies are listed 'Best First'.
Re^2: Finding match offsets of named captures in 5.10 regex
by JadeNB (Chaplain) on Sep 28, 2008 at 18:40 UTC
    It seems that the whole point of using named captures is not wanting to have to keep track of the position of those captures, so maybe this way of getting at it isn't so useful. Is there any programmatic way to translate from named captures to the corresponding numbers?