# NOT RUN {
# create an expression
x <- rx_find(value = "foo") %>%
rx_or(rx_find(value = "bar"))
# create strings
string1 <- "foo!"
string2 <- "bar!"
# extract matches
regmatches(string1, gregexpr(x, string1))[[1]]
regmatches(string2, gregexpr(x, string2))[[1]]
# }
Run the code above in your browser using DataLab