tp=['[k1]--[k1]:[k2]']; m={"[k1]":"v1", "[k2]":"v2"}; r=tpl.map((t)=>{return t.replace(/\[(.*?)\]/g,(x)=>{return m[x]})});