I have an array with:
emoticons = { \':-)\' : \'smile1.gif\', \':)\' : \'smile2.gif\', \':D\' : \'smile3.gif\' }
then i hav
Using a regex with an array of find replace elements works well.
var emotes = [ [':\\\)', 'happy.png'], [':\\\(', 'sad.png'] ]; function applyEmotesFormat(body){ for(var i = 0; i < emotes.length; i++){ body = body.replace(new RegExp(emotes[i][0], 'gi'), ''); } return body; }