我正在尝试使用以下代码:
x <- scan("myfile.txt", what="", sep="\n")
b <- grep('/^one/(.*?)/^four/', x, ignore.case = TRUE, perl = TRUE, value = TRUE,
fixed = FALSE, useBytes = FALSE, invert = FALSE)
从 myfile.txt 中提取文本的移植
zero
one
two
three
four
five
我期待的输出是
one
two
three
four
我想包括“一”和“四”我不想放弃它们:)
但不知何故,正则表达式不起作用,控制台输出没有给出错误但也没有文本......?
我正在使用打印(b)