i have a simple smily parser code :
for (var key in smiles) {
text = text.replace(key , smiles[key]);
}
return text;
so the problem is , this will only replace the first one so i've switched to global replace
for (var key in smiles) {
var r = '/'+key+'/g';
console.log(r);
text = text.replace(r , smiles[key]);
}
in console i have :
/:)/g
/;)/g
/:(/g
which seems to be ok , but it wont replace any of these codes :) ;) :(
whats wrong ?