in reply to Re^2: Finding the index of a string with a regexp
in thread Finding the index of a string with a regexp

The first thing that comes to mind is substracting the length of the match, like in:

pos ($state) - length $&

--
David Serrano