如果单词以4个或更多重复字符开头,我想从句子中删除一个单词。你知道吗
eg:
['aaaaaaa is really good', 'nott something great',
'ssssssssssssstackoverflow is a great community']
我需要这样的输出: 例如:
['is really good', 'nott something great', 'is a great community']
我试过这样的方法:
^(\S)\1{3,}
它确实会删除那些重复的字符,但不会删除单词。谢谢
在模式末尾添加
\S*\s
:输出:
如果字符串可能只由一个单词组成,那么将最后的空格设为可选的
\s?
而不是\s
。你知道吗相关问题 更多 >
编程相关推荐