R - 展望正则表达式

时间:2016-01-27 19:34:09

标签: r

尝试拆分并包含。到目前为止,我可以看看好了。

string_txt <- "apple eat bear"

strsplit(string_txt, "(?<=eat)", perl = TRUE)
[[1]]
[1] "apple eat" " bear"

但是,当我试着向前看时,“吃”这个词就会分开。

strsplit(string_txt, "(?=eat)", perl = TRUE)
[[1]]
[1] "apple "  "e"       "at bear"

0 个答案:

没有答案