Vectorize grepl

vgrepl(
  pattern,
  x,
  ignore.case = TRUE,
  perl = FALSE,
  fixed = FALSE,
  useBytes = FALSE
)

Arguments

pattern

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. Missing values are allowed except for regexpr, gregexpr and regexec.

x

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

logical. if FALSE, the pattern matching is case sensitive and if TRUE, case is ignored during matching.

perl

logical. Should Perl-compatible regexps be used?

fixed

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

useBytes

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

Value

a matrix with as many rows as length(x) and as many columns as length(pattern) containing TRUE or FALSE. Each column is the result of call to grepl.

Details

This function works the same way as grepl but with a vectorize pattern. This means that if the argument pattern has a length >= 2 then the output will be calculated iteratively by pattern. So instead of having a vector as output, we get a matrix with length(pattern) rows and length(pattern) columns.

For more informations, see the function grepl.