0

There are several answers around the web on how to remove diacritics from strings in javascript, one of the ways being something along the lines of

myString.normalize('NFD').replace(/[^a-zA-Z]/g, '')

However, this doesn't remove some special characters such as hooks or slashes through letters such as in the following characters: Ø Ɓ

How would I go about removing the slash in the Ø and the hook in the Ɓ such that a strings like 'ØƁI WAN KENOBI' turns into 'OBI WAN KENOBI'. Is there a generally applicable solution (either with regex or a npm package) that can transform a string such that it no longer contains any diacritics or weird symbols and transforms the characters to their respective A-Z forms?

Edit - someone marked this question as a duplicate and linked to the exact question that I said didn't answer my question (if they read the question properly then they would have realised this). However, for anyone coming here, the comment below this question with the linked NPM package perfectly answers this question.

Adnan Siddiquei
  • 433
  • 1
  • 5
  • 11

0 Answers0