Created
February 18, 2020 13:10
-
-
Save jrmarqueshd/750a1c738d914d20602050775f17e919 to your computer and use it in GitHub Desktop.
Remover palavras com acento usando RegEx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parsed = "João"; | |
parsed = parsed.replace(new RegExp("[ÁÀÂÃ]", "gi"), "a"); | |
parsed = parsed.replace(new RegExp("[ÉÈÊ]", "gi"), "e"); | |
parsed = parsed.replace(new RegExp("[ÍÌÎ]", "gi"), "i"); | |
parsed = parsed.replace(new RegExp("[ÓÒÔÕ]", "gi"), "o"); | |
parsed = parsed.replace(new RegExp("[ÚÙÛ]", "gi"), "u"); | |
parsed = parsed.replace(new RegExp("[Ç]", "gi"), "c"); | |
console.log(parsed); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment