regex to replace words with more than two consecutive characters

后端 未结 3 725
说谎
说谎 2021-01-17 05:25

How can I detect the presence of more than two consecutive characters in a word and remove that word?

I seem to be able to do it like this:

# example         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-17 05:51

    An other possibility :

    mystring[grepl("(.{1})\\1{2,}", mystring, perl=T)] <- ""
    

提交回复
热议问题