How to replace characters in a string with other characters?
<p>I want to replace certain characters in a string with other characters. I´ve did my research and found that the best way is to use regular expressions...
But, something doesn´t work ...
Here´s what i did so far...</p>

<pre><code>var alphabet = {
   'á':'a',
   'é':'e',
   'í':'i'
};

var word = $("input[name=phrase]").val();
alert(word);  //output: ok!

var url = word.replace(/áéí|/g, function(s) {
    return alphabet[s];
});

alert(url); //output: undefined,undefined,undefined...
</code></pre>
