" R"语言能够跨越"换行符执行正则表达式检查\ n \ r" 考虑以下模式:我们需要找到给定的" Sage得分"什么是"最终得分"
下面的示例文字"access - SAFPS Members only\n Sample PreScore\n The Sage score is a generic scorecard which indicates the\n associated with a consumer by taking into consideration the\n or default.\n Identifier Date Final Score Exception\n 4738998 2015-08-31 600 Debt Summary \n This section displays a summary of all the consumer's current debt obligations"
我的代码如下
# Read text file, get line position of \n
con=file("C:\\Sample.txt",open="r")
lines=readLines(con) # line position of sage score
index <- grep("Sage score",lines,value=FALSE,ignore.case=TRUE)
valueLine <- lines[index+2]
value line returns tokenize for 3rd token.
4738998 2015-08-31 600
问题是没有读取整个文件我们是否有跨行的R正则表达式?