如何删除R中特定单词后的空格

时间:2017-11-05 10:57:39

标签: r

例如,如果单词是happy,那么:

输入:"The Bunny is happy to be alive, the Rabbit is happy too"

输出:"The Bunny is happyto be alive, the Rabbit is happytoo"

谢谢

1 个答案:

答案 0 :(得分:1)

使用以下正则表达式

(?<=happy)\\s

在您的问题的评论中,您正在替换上的 + whitesace 。但是在上面的方法中,您正在删除空格。