Created
March 14, 2019 09:25
-
-
Save richard457/0e8d4a11c51955539337a0469d16b6a1 to your computer and use it in GitHub Desktop.
Cleaning a string in JavaScript.
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
let dirtyString= "[Hello world]"; | |
dirtyString.replace(/([^a-z0-9]+)/gi, ''); | |
console.log(dirtyString); // Hello world | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment