Learn R Programming

Kmisc (version 0.4.0-1)

re.exists: Check whether Regular Expression was Found

Description

Checks whether a match was found for a given regular expression in a vector. See examples for usage.

Usage

re.exists(pattern, x, perl = TRUE, ...)

Arguments

pattern
regex pattern passed to grep.
x
vector on which we attempt to match pattern on.
perl
boolean. use perl-compatible regular expressions?
...
additional arguments passed to grep.

See Also

lg

Examples

Run this code
if( re.exists("^ap", c("apple", "banana") ) ) print("yay!")

Run the code above in your browser using DataLab