Jiaxiang Li 2018-12-18
strings <- c("a", "ab", "acb", "accb", "acccb", "accccb")
grep("ac+b", strings, value = TRUE)
#> [1] "acb" "accb" "acccb" "accccb"
grep("ac.+b", strings, value = TRUE)
#> [1] "accb" "acccb" "accccb"
grep("ac.b", strings, value = TRUE)
#> [1] "accb"
Created on 2018-12-18 by the reprex package (v0.2.1)
这里的
+
= rebus::one_or_more()
.
= rebus::ANY_CHAR
参考 Cheatsheet