grepv: grep that returns the value of the match.

View source: R/CodeAndRoll2.R

grepvR Documentation

grep that returns the value of the match.

Description

grep returning the value. A character string containing a regular expression (or character string for fixed = TRUE) to be matched in the given character vector. Coerced by as.character to a character string if possible. If a character vector of length 2 or more is supplied, the first element is used with a warning. Missing values are allowed except for regexpr, gregexpr and regexec.

Usage

grepv(
  pattern,
  x,
  ignore.case = FALSE,
  perl = FALSE,
  value = FALSE,
  fixed = FALSE,
  useBytes = FALSE,
  invert = FALSE,
  ...
)

Arguments

pattern

pattern to look for

x

The haystack to search through. a character vector where matches are sought, or an object which can be coerced by as.character to a character vector. Long vectors are supported.

ignore.case

Ignore letter case, Default: FALSE

perl

logical. Should Perl-compatible regexps be used? Default: FALSE

value

if FALSE, a vector containing the (integer) indices of the matches determined by grep is returned, and if TRUE, a vector containing the matching elements themselves is returned. Default: FALSE

fixed

logical. If TRUE, pattern is a string to be matched as is. Overrides all conflicting arguments. Default: FALSE

useBytes

logical. If TRUE the matching is done byte-by-byte rather than character-by-character. See ‘Details’., Default: FALSE

invert

logical. If TRUE return indices or values for elements that do not match. Default: FALSE

...

Pass any other argument.


vertesy/CodeAndRoll2 documentation built on Nov. 20, 2024, 5:23 a.m.