【发布时间】:2020-01-27 19:37:51
【问题描述】:
Question 与how to extract a string from between two other strings 完全相同,只是在其他两个字符串之间提取所有字符串。
要使用与原始问题类似的示例,假设我们希望从字符串中提取GET_ME 和GET_ME_TOO
a <-" anything goes here, STR1 GET_ME STR2, anything goes here STR1 GET_ME_TOO STR2"
res <- str_match(a, "STR1 (.*?) STR2")
res[,2]
[1] "GET_ME"
这会检索第一次,但不是第二次(或后续)出现
问题
我们如何在其他两个字符串之间提取所有字符串?
【问题讨论】: