if (replacements.length < intGroupCount)
throw new RuntimeException("replacements missing: " + replacements.length + " replacement(s) defined but " + intGroupCount + " groups found");
// no groups, exchange the whole string
if (intGroupCount == 0) {
result = pstrSourceString.substring(0, m.start()) + replacements[0] + pstrSourceString.substring(m.end());
}
else {
int index = 0;
for (int i = 1; i <= intGroupCount; i++) {