This expression will match everything except line breaks using
the dot and the star. The Dot .
is a
metacharacter and the Star *
is a quantifier. When
combined the expression is considered greedy because it will match everything
(except line breaks) 0 or more times.
rx_anything(.data = NULL, mode = "greedy")
.data | Expression to append, typically pulled from the pipe |
---|---|
mode | Matching mode ( |
Dot: https://www.regular-expressions.info/dot.html
Star Quantifier: https://www.regular-expressions.info/repeat.html
Greedy and Lazy Quantifiers: https://www.regular-expressions.info/repeat.html#greedy
rx_anything()#> [1] "(.*)"rx_anything(mode = "lazy")#> [1] "(.*?)"x <- rx() %>% rx_start_of_line() %>% rx_anything() %>% rx_end_of_line() grepl(x, "anything!") # this should be true#> [1] TRUE#> [1] TRUE#> [1] FALSE