I am using str_match in R to extract values between start and end strings. For example, my code looks like this:
str_match("xxxxxBeginning Middle Endxxxxxxxx","(Beginning.+?)End")[,2]
This currently outputs Beginning Middle. How do I get an output of just Middle alone, without Beginning?
Just put the brackets around the part you want to extract.
stringr::str_match("xxxxxBeginning Middle Endxxxxxxxx","Beginning (.+?) End")[,2]
#[1] "Middle"