rx_maybe | R Documentation |
This expression uses a quantifier ?
to optionally
match things. Specifically, the question mark makes the preceding token in
the regular expression optional.
rx_maybe(.data = NULL, value)
.data |
Expression to append, typically pulled from the pipe |
value |
Expression to optionally match |
Quantifiers: https://www.regular-expressions.info/optional.html
rx_maybe(value = "abc")
# create expression
x <- rx() %>%
rx_start_of_line() %>%
rx_maybe("abc") %>%
rx_end_of_line(enable = FALSE)
grepl(x, "xyz") # should be true
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.