I need to turn a list of last names into alphanumeric usernames, however unfortunately some of them contain non-ascii characters:
Hernández
Quermançós
Migueláñez
Now one way would just to use a regex to remove any non-alpha numeric characters such as a.replace(/[^a-z0-9]/gi,'')
. However a more intuitive solution (at least for the user) would be to replace accented characters with their plain equivalent, e.g. turn á
, á
into a
, and ç
into c
, etc. Is there an easy way to do this in javascript?