rx_anything_but: Match any character(s) except these any (including zero)...

View source: R/rules.R

rx_anything_butR Documentation

Match any character(s) except these any (including zero) number of times.

Description

This expression will match everything except whatever characters the user specifies in the value parameter. It does this by adding a caret symbol ^ at the beginning of a character set []. Typing a caret after the opening square bracket negates the character class. The result is that the character class matches any character that is not in the character class. Unlike the dot, negated character classes also match (invisible) line break characters. If you don't want a negated character class to match line breaks, you need to include the line break characters in the class.

Usage

rx_anything_but(.data = NULL, value, mode = "greedy")

Arguments

.data

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

value

Characters to not match

mode

Matching mode (greedy (default) orlazy). Lazy matching stops after the first match, greedy continues searching until end of the string and then back-tracks to the last match.

References

Character Class: https://www.regular-expressions.info/charclass.html

Examples

rx_anything_but(value = "abc")


RVerbalExpressions documentation built on May 29, 2024, 6:47 a.m.