如何将纵梁移除到多行文档的末尾?
require(stringr)
x = 'The quick brown
fox jumps over
the lazy dog'
str_remove(x, regex('jumps.*', multiline = TRUE)) %>% cat
#> The quick brown
#> fox
#> the lazy dog
答案 0 :(得分:1)
该解决方案如何?
library(stringr)
library(dplyr)
x = 'The quick brown
fox jumps over
the lazy dog'
str_replace(x, regex('jumps.*\n*.*'), "") %>% cat
应与:
str_remove(x, regex('jumps.*\n*.*')) %>% cat