code:
var myCode = [ [new RegExp("a","g"),"XyZ"],[new RegExp("A","g"),"xYz"] ];
tmpMessage = tmpMessage.replace(myCode[0][0],myCode[0][1]);
tmpMessage = tmpMessage.replace(myCode[1][0],myCode[1][1]);
1. You made your arrays wrong [ ["Stuff","Stuff2"], ["Stuff3","Stuff4"] ] Thats how to make a multidimensional
2. For replace you need either /texttofind/options or a RegExp object for the first argument.