# NOT RUN {
rx_word_edge()
x <- rx_word_edge() %>%
rx_alpha() %>%
rx_one_or_more() %>%
rx_word_edge()
# create inputs
string1 <- "foobar"
string2 <- "foo 23a bar"
# matches 'foobar'
regmatches(string1, regexpr(x, string1))
# matches 'foo' and 'bar' separately
regmatches(string2, gregexpr(x, string2))
# }
Run the code above in your browser using DataLab