static S expandDollarRefsToMatches(S s, Matches m) { L tok = javaTok(s); for (int i = 1; i < l(tok); i += 2) { S t = tok.get(i); if (!t.startsWith("$")) continue; t = dropFirst(t); int j = parseLastInteger(t); if (j < 1) continue; S x = get(m.m, j-1); if (x == null) continue; if (startsWith(t, "quoted")) x = quote(x); tok.set(i, x); } ret join(tok); }