Last active
April 4, 2018 15:39
-
-
Save iGitScor/5a69b94b8c3f4329cb446c35aa4b9eeb to your computer and use it in GitHub Desktop.
Normalize
This file contains hidden or 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
"mon string avé des accents".normalize("NFD").replace(/[\u0300-\u036f]/g, ''); // Remove accent | |
"mon string avé des accents".normalize("NFD").replace(/([^a-zA-Z0-9 ]*)/g, ''); // Keep only letters, numbers and space | |
"mon string avé des accents".normalize("NFD") | |
.replace(/[\u0300-\u036f]/g, '') | |
.replace(/([^a-zA-Z0-9 ]*)/g, '') // Remove accent and then keep letters, numbers and space | |
"mon string avé des accents".normalize("NFD") | |
.replace(/[\u0300-\u036f]/g, '') | |
.replace(/[\/!-,]/g, '') // Remove slash ("/"), interrogation point ("!"), dash ("-"), comma (",") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment