in reply to Regex for replacing capture group content using perl

Trying to change all of the indexes ending in _pr (or _np) to window_pr (or window_np)

If that is really all you need to do, and you haven't left out any special cases, then I think you might be overcomplicating the solution a bit - the following will change any index = .*_(np|pr) line, regardless of section.

perl -pe 's/^index\s*=\s*\K.+(?=_(?:np|pr)\s*$)/window/' inputs.conf