I have a string for example:
var string = \'This is a text that needs to change\';
And then I have two arrays.
var array1 =
This sets up 1 RegExp
and calls replace
only once.
var string = 'This is a text that needs to change';
var array1 = new Array('a', 'e', 'i', 'o', 'u');
var array2 = new Array('1', '2', '3', '4', '5');
var regex = new RegExp( '['+array1.join('')+']', 'g' );
var lookup = {}; // Setup a hash lookup
for( var i=0 ; i
http://jsfiddle.net/2twr2/