contains_pattern: Check if strings contain a regex pattern

View source: R/assert_regex.R

contains_patternR Documentation

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
)

Arguments

x

A character vector to check

pattern

A regular expression pattern (string)

ignore.case, perl, fixed, useBytes

Logical flags passed to grepl()

Value

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


assertions documentation built on Feb. 13, 2026, 5:06 p.m.