Match placeholders in the replacement string with matched subgroups.