rx_avoid: Negative lookaround functions

rx_avoid_prefixR Documentation

Negative lookaround functions

Description

This function facilitates matching by providing negative assurances for surrounding symbols/groups of symbols. It allows for building expressions that are dependent on context of occurrence.

Usage

rx_avoid_prefix(.data = NULL, value)

rx_avoid_suffix(.data = NULL, value)

Arguments

.data

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

value

Exact expression to match

Examples

# matches any number of digits, but not preceded by "USD"
rx() %>%
  rx_avoid_prefix('USD') %>%
  rx_digit() %>%
  rx_one_or_more()

#matches a digit, but not followed by " dollars"
rx() %>%
  rx_digit() %>%
  rx_avoid_suffix(' dollars')


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