rx_either_of: Alternatively, match either expression.

View source: R/rules.R

rx_either_ofR Documentation

Alternatively, match either expression.

Description

Expression to match instead. If both expressions exists, both will be returned. This just adds the vertical bar | often called an alternator which allows the user to find this or that, or both!

Usage

rx_either_of(.data, ...)

Arguments

.data

Expression to append, typically pulled from the pipe %>%

...

A character vector

Examples

x <- rx() %>%
  rx_either_of("cat", "dog") %>%
  rx_space() %>%
  rx_find("food")

string <- c("dog food", "cat food", "fish food")

grep(x, string, value = TRUE)

VerbalExpressions/RVerbalExpressions documentation built on March 27, 2024, 8:20 a.m.