我正在尝试用正则表达式解析一个字符串,以提取冒号和下一个冒号之前的最后一个换行符之间的信息。我该怎么做呢?
string <- "Name: Al's\nPlace\nCountry:\nState\n/ Province: RI\n"
stringr::str_extract_all(string, "(?<=:)(.*)(?:\\n)")
但我得到了:
[[1]]
[1] " Al's\n" " \n" " RI\n"
当我需要的时候:
[[1]]
[1] " Al's\nPlace\n" " \n" " RI\n"
发布于 2019-05-22 06:12:09
https://stackoverflow.com/questions/56245970
复制相似问题