最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Remove all non-lower case characters from string - Stack Overflow

programmeradmin3浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 20

You could:

str.replace( /[^a-z]/g, '' );
发布评论

评论列表(0)

  1. 暂无评论