Match beginning or end of a word—a string consisting of of word characters (a–z, A–Z, 0–9 or _).

rx_word_edge(.data = NULL)

Arguments

.data

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

Examples

rx_word_edge()
#> [1] "\\b"
x <- rx() %>% rx_word_edge() %>% rx_alpha() %>% rx_one_or_more() %>% rx_word_edge() # create inputs string1 <- "foobar" string2 <- "foo 23a bar" # matches 'foobar' regmatches(string1, regexpr(x, string1))
#> [1] "foobar"
# matches 'foo' and 'bar' separately regmatches(string2, gregexpr(x, string2))
#> [[1]] #> [1] "foo" "bar" #>