Learn R Programming

kim (version 0.6.1)

regex_match: Regular expression matches

Description

Returns elements of a character vector that match the given regular expression

Usage

regex_match(regex = NULL, vector = NULL, silent = FALSE, perl = FALSE)

Arguments

regex

a regular expression provided, a default theme will be used.

vector

a character vector in which to search for regular expression matches, or a data table whose column names will be searched

silent

logical. If silent = FALSE, a report on regular expression matches will be printed. If silent = TRUE, the report on regular expression matches will not be printed. By default, silent = FALSE

perl

logical. Should Perl-compatible regexps be used?

Examples

Run this code
regex_match("p$", names(mtcars))
# \donttest{
colnames_ending_with_p <- regex_match("p$", names(mtcars))
# }

Run the code above in your browser using DataLab