%o~% {operators} | R Documentation |
The operator %o~% is used to retain the only the part of the txt
that matches the regular expression.
txt %o~% pattern
txt |
Character vector |
pattern |
Regular expression |
In case where parts of the regular expression are surrounded by brackets, the operator returns a matrix with as many lines as the length of txt and as many columns as chunks of regular expressions.
Romain Francois francoisromain@free.fr
x <- c("foobar","barfooooooooooooobar") x %o~% "fo+"