check if word has accented or unaccented javascript 1

check if word has accented or unaccented javascript

//Normalize diacritics characters from originalText
var originalText = "éàçèñ"
var result = originalText.normalize('NFD').replace(/[\u0300-\u036f]/g, "")
console.log(result)

Here is what the above code is Doing:
1. The first line is the original text.
2. The second line is the result of the normalization.
3. The third line is the result of the normalization and the replacement of the diacritics characters.

The result of the third line is:
eaceñ

Similar Posts