5

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?

Thomas
  • 1,085
  • 5
  • 19
  • 33

1 Answers1

18

You could:

str.replace( /[^a-z]/g, '' );
Lucas
  • 14,227
  • 9
  • 74
  • 124