sql = sql.replace(/DECRYPT\(\*\)/ig|>, "*");
// match any ENCRYPT(?, ?, ?, etc) occurrences,// then replace with just the question marks in the// middlevar matches = sql.match(/ENCRYPT\([^\)]*\)/ig|>);
if(matches != null){for(var i = 0; i < matches.length; i++){var encryptStatement = matches[i];
var encryptValue = encryptStatement.match(/ENCRYPT\(([^\)]*)\)/i|>)[1];
sql = sql.replace(encryptStatement, encryptValue);
}}// match any DECRYPT(COL1, COL2, etc) occurrences,// then replace with just the column names// in the middle
matches = sql.match(/DECRYPT\([^\)]*\)/ig|>);
if(matches != null){for(var i = 0; i < matches.length; i++){var decryptStatement = matches[i];
var decryptValue = decryptStatement.match(/DECRYPT\(([^\)]*)\)/i|>)[1];
sql = sql.replace(decryptStatement, decryptValue);
}}return sql;