static S expandDollarRefsToMatches(S s, Matches m) { L tok = javaTok(s); for (int i = 1; i < l(tok); i += 2) { if (tok.get(i).startsWith("$") && isInteger(tok.get(i).substring(1))) { S x = get(m.m, parseInt(tok.get(i).substring(1))-1); tok.set(i, unnull(x)); } } ret join(tok); }