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