# NOT RUN {
# match space, default
rx_space()
# dont match space
rx_space(inverse = TRUE)
# create an expression
x <- rx_space()
# create input
string <- "1 apple\t"
# extract match
regmatches(string, regexpr(x, string))
# extract no whitespace by inverting behavior
y <- rx_space(inverse = TRUE)
regmatches(string, gregexpr(y, string))
# }
Run the code above in your browser using DataLab