void () { StringWithId string = new StringWithId("first-second"); MatchData data = regex("([A-z]+)-([A-z]+)").match(string, null); assertEquals("first+second+first", SyntaxMatchUtils.replaceGroupsWithMatchDataInCaptures("$1+$2+$1", string, data)); }