Stripping diacriticals from Russian text

While you seldom find diacritical markings in Russian text outside of that intended to help young readers or language learners, you occasionally have to deal with these markings. Here is a method to deal with it.

const str = "Он горева́л по по́воду сме́рти лу́чшего дру́га."
var res = str.normalize("NFD").replace(/[\u0300-\u036f]/g, "")
document.getElementById("demo").innerHTML = `Original: ${str} | Stripped: ${res}`

Output: Original: Он горева́л по по́воду сме́рти лу́чшего дру́га. | Stripped: Он горевал по поводу смерти лучшего друга.

Alan Duncan avatar
About Alan Duncan
Ertswhile physician. Musician. Polymath. Language geek. French C2. Russian B2. Contact me here if you must.