# NOT RUN {
rx_punctuation()
rx_punctuation(inverse = TRUE)
# create an expression
x <- rx_punctuation()
# create input
string <- 'Apple 1!'
# extract match
regmatches(string, gregexpr(x, string))
# dont extract punctuation
y <- rx_punctuation(inverse = TRUE)
regmatches(string, gregexpr(y, string))
# }
Run the code above in your browser using DataLab