Last active
March 30, 2021 13:47
-
-
Save ErickWendel/6c32544e0686a3374d707a76a2369239 to your computer and use it in GitHub Desktop.
Example of keeping only words and words which have accents on a JS String
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
'N,.ã_o)d-á'.replace(/([^A-zÀ-ÿ]|_)/g, '') | |
// "Nãodá" | |
// ( => starts a group | |
// [^A-zÀ-ÿ]=> find only not words including with accents | |
// |_ => or find _ literally | |
// ) => ends a group | |
// g => global - keep searching 'till the end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment