rx_word_edge: Find beginning or end of a word.

View source: R/rules.R

rx_word_edgeR Documentation

Find beginning or end of a word.

Description

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

Usage

rx_word_edge(.data = NULL)

Arguments

.data

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

Examples

rx_word_edge()

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))
# matches 'foo' and 'bar' separately
regmatches(string2, gregexpr(x, string2))

VerbalExpressions/RVerbalExpressions documentation built on March 27, 2024, 8:20 a.m.