sS regexpReplaceWithFirstGroup(Pattern pat, S s) { ret regexpReplaceWithFirstGroup(regexp(pat, s)); } // TODO: why IC? sS regexpReplaceWithFirstGroup(S pat, S s) { ret regexpReplaceWithFirstGroup(regexpIC(pat, s)); } sS regexpReplaceWithFirstGroup(Matcher m) { new StringBuffer buf; while (m.find()) m.appendReplacement(buf, m.group(1)); m.appendTail(buf); ret str(buf); }