%o~% {operators}R Documentation

Only keeps the macthing part of a regular expression

Description

The operator %o~% is used to retain the only the part of the txt that matches the regular expression.

Usage

txt %o~% pattern

Arguments

txt

Character vector

pattern

Regular expression

Value

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.

Author(s)

Romain Francois francoisromain@free.fr

Examples

x <- c("foobar","barfooooooooooooobar")
x %o~% "fo+"

[Package operators version 0.1-8 Index]