regex_match function

Regular expression matches

Regular expression matches

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

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

regex_match("p$", names(mtcars)) colnames_ending_with_p <- regex_match("p$", names(mtcars))