SyntaxFix
Write A Post
Hire A Developer
Questions
If you want to retain only alphabets and spaces, you can do:
str.replace(/[^a-zA-Z ]+/g, '').replace('/ {2,}/',' ')