相关疑难解决方法(0)

R/regex with stringi/ICU:为什么'+'被认为是非[:punct:]字符?

我正在尝试从字符串向量中删除非字母字符.我认为[:punct:]分组会覆盖它,但它似乎忽略了+.这属于另一组角色吗?

library(stringi)
string1 <- c(
"this is a test"
,"this, is also a test"
,"this is the final. test"
,"this is the final + test!"
)

string1 <- stri_replace_all_regex(string1, '[:punct:]', ' ')
string1 <- stri_replace_all_regex(string1, '\\+', ' ')
Run Code Online (Sandbox Code Playgroud)

regex string r icu stringi

15
推荐指数
2
解决办法
704
查看次数

标签 统计

icu ×1

r ×1

regex ×1

string ×1

stringi ×1