Constructs a character class, sometimes called a character set. With this particular expression, you can tell the regex engine to match only one out of several characters. It does this by simply placing the characters you want to match between square brackets.
rx_any_of(.data = NULL, value)
.data | Expression to append, typically pulled from the pipe |
---|---|
value | Expression to optionally match |
Character class: https://www.regular-expressions.info/charclass.html
rx_any_of(value = "abc")#> [1] "[abc]"#> [1] TRUE#> [1] FALSEy <- rx() %>% rx_find("gr") %>% rx_any_of("ae") %>% rx_find("y") regmatches("gray", regexec(y, "gray"))[[1]]#> [1] "gray" "gr" "y"#> [1] "grey" "gr" "y"