rem:   pattern = /\$\{(\w+)\}\.(.+)/;  var variableIndex = str; var variableFunction='';  if(pattern.test(str)) { pieces = str.split('.');  variableIndex = pieces[0]; variableFunction = pieces[1]; 
add:   var stringResult = str; var match; while (match = stringResult.match(/\$\{(\w+)\}/)) { var variable = match[0]; var name = match[1]; var replacement = storedVars[name]; stringResult = stringResult.replace(variable, replacement); 
context: function replaceVariables(str) {     //handle the case of ${userid}.toUpper    pattern = /\$\{(\w+)\}\.(.+)/;    var variableIndex = str;    var variableFunction='';    if(pattern.test(str)) {        pieces = str.split('.');        variableIndex = pieces[0];        variableFunction = pieces[1];    }    regex = /\$\{(\w+)\}/g;    var variableValue = variableIndex.replace(regex, function(match, word) {        return storedVars[word];    });    if( variableFunction == '')            return variableValue;    else    {        return eval("variableValue."+ eval("variableFunction") + "()" );    }}
meta: 3428	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/3428/9ca80d595050f0f7dc4cfc89733ae82e15cd4d72/selenium-fitrunner.js/clean/code/javascript/selenium-fitrunner.js