string1<-"ccjar_neutral v_neutral vaux_neutral nnp_neutral prn_neutral v_neutral inj_neutral"
如何将正则表达式写入
仅提取&#34; v_neutral&#34;来自string1
提取&#34; v_neutral vaux_neutral&#34;来自string1
答案 0 :(得分:0)
我的猜测......
str_extract_all(string1, "\\b(v\\w+)(?:\\s+v\\w+)\\b")[[1]]
# [1] "v_neutral vaux_neutral"
str_extract_all(string1, "\\b(v\\w+)(?=\\s+v\\w+)\\b")[[1]]
# [1] "v_neutral"