in reply to Getting information about regexp matches

In Perl 5.6.0 and later you can use the arrays @- and @+ (@LAST_MATCH_START and @LAST_MATCH_END) to get the beginning and ending offsets of the entire match ($-[0] and $+[0]), and the beggining and ending offset for each subpattern match. The beginning and ending offsets for $1, for example, will be found in $-[1] and $+[1].

for more information, see: perlvar

  • Comment on Re: Getting information about regexp matches