dot-check_value_chr: Check character values against one or more regex patterns

.check_value_chrR Documentation

Check character values against one or more regex patterns

Description

Check character values against one or more regex patterns

Usage

.check_value_chr(x, regex, x_arg = caller_arg(x), call = caller_env())

Arguments

x

The argument to stabilize.

regex

⁠(character, list, or stringr_pattern)⁠ One or more optional regular expressions to test against the values of x. This can be a character vector, a list of character vectors, or a pattern object from the {stringr} package (e.g., stringr::fixed("a.b")). The default error message for non-matching values will include the pattern itself (see regex_must_match()). To provide a custom message, supply a named character vector where the value is the regex pattern and the name is the message that should be displayed. To check that a pattern is not matched, attach a negate attribute set to TRUE. If a complex regex pattern throws an error, try installing the stringi package.

x_arg

⁠(length-1 character)⁠ An argument name for x. The automatic value will work in most cases, or pass it through from higher-level functions to make error messages clearer in unexported functions.

call

(environment) The execution environment to mention as the source of error messages.

Value

NULL, invisibly, if x passes all checks.


stbl documentation built on Nov. 5, 2025, 6:02 p.m.