2つのパターンの間にある部分文字列を抽出しようとしていBB
ます</p>
:
require("stringr")
str = "<notes>\n <p>AA:</p>\n <p>BB: word, otherword</p>\n <p>Number:</p>\n <p>Level: 1</p>\n"
str_extract(str, "BB.*?:</p>")
抽出された部分文字列は「word、otherword」である必要がありますが、キャプチャしすぎています。
[1] "BB: word, otherword</p>\n <p>Number:</p>"