%~% {tractor.base}R Documentation

Test a character vector for a match against a regular expression

Description

Test if a the elements of a character vector match a Perl regular expression.

Usage

X %~% Y

Arguments

X A character vector to test for a match.
Y A character vector of length one representing a Perl regular expression to match against.

Details

This function is infix shorthand for regexpr(Y,X,perl=TRUE) != -1.

Value

TRUE if X matches the regular expression described by Y.

Author(s)

Jon Clayden

See Also

regexpr

Examples

c("foo", "foo bar") %~% "\\w+\\s+(\\w+)?"  # c(FALSE, TRUE)

[Package tractor.base version 1.3.0 Index]