Skip to content

Instantly share code, notes, and snippets.

@ajsb85
Forked from sindresorhus/strip-accents.js
Last active August 29, 2015 14:06
Show Gist options
  • Save ajsb85/b8680a9b42486c1f279b to your computer and use it in GitHub Desktop.
Save ajsb85/b8680a9b42486c1f279b to your computer and use it in GitHub Desktop.
function stripAccents(str) {
var reAccents = /[àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ]/g;
var replacements = 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY';
return str.replace(reAccents, function (match) {
return replacements[reAccents.source.indexOf(match)];
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment