如果在R中多次同时包含字母/特殊字符,则regex将删除单词

如果在R中多次同时包含字母/特殊字符,则regex将删除单词,regex,string,r,gsub,Regex,String,R,Gsub,我想删除单词中字母/特殊字符数同时出现两次以上的单词 例如,输入如下 "Google in theee lland of whhhat c#, c++ and e###" 输出应该是 "Google in lland of c#, c++ and" x x <- "Google in theee lland of whhhat c#, c++ and e###" gsub("\\S*(\\S)\\1\\1\\S*\\s?", "", x) # [1] "Google in lland

我想删除单词中字母/特殊字符数同时出现两次以上的单词

例如,输入如下

"Google in theee lland of whhhat c#, c++ and e###"
输出应该是

"Google in lland of c#, c++ and"
x
x <- "Google in theee lland of whhhat c#, c++ and e###"
gsub("\\S*(\\S)\\1\\1\\S*\\s?", "", x)
# [1] "Google in lland of c#, c++ and "