I understand that given a string str
str.replace(/\s/g,'');
will remove all spaces in a string.
How can I remove all characters that are not lower case letters from the string?
I understand that given a string str
str.replace(/\s/g,'');
will remove all spaces in a string.
How can I remove all characters that are not lower case letters from the string?
Share Improve this question asked Mar 22, 2013 at 19:59 ThomasThomas 1,1056 gold badges19 silver badges33 bronze badges1 Answer
Reset to default 20You could:
str.replace( /[^a-z]/g, '' );