sS replaceSquareBracketVars(S s, O... params) { if (empty(params)) ret s; MapSO vars = mapKeys deSquareBracket((MapSO) litcimap(params)); ret regexpReplaceIC(s, "\\[(.+?)\\]", matcher -> { S var = matcher.group(1); O val = vars.get(var); ret val == null ? matcher.group() : str(val); }); }