js code:for(var key in some_variables) input = input.replace(new RegExp("%var:"+key+"%", "gi"), some_variables[key]);