【发布时间】:2015-07-24 17:39:45
【问题描述】:
目标:把x变成y;其中 x 具有任意数量的空格、\rs 和 \ns。
x <- "some text, \r\n \r\n)more text"
y <- "some text)more text"
我使用 str_replace_all() 做了一些尝试:
str_replace_all(x, "[,][ \r\n][)]", "")
str_replace_all(x, ",[ \r\n])", "")
【问题讨论】:
-
任意字符数?你的意思是
[add chars here]+吗?或者,像,[ \r\n]*(?=\))?
标签: regex r string text stringr