Learn R Programming

assertions (version 0.3.0)

contains_pattern: Check if strings contain a regex pattern

Description

This helper checks whether all elements of a character vector match a regex pattern.

Usage

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

Value

TRUE if all strings in x match pattern, otherwise FALSE or a string error message.

Arguments

x

A character vector to check

pattern

A regular expression pattern (string)

ignore.case, perl, fixed, useBytes

Logical flags passed to grepl()