Select should only replace the matched text.

When using multiple capturing groups and the index parameter often times the non-capturing groups/groups outside of the specified index get consumed. This fixes that.