WordBoundaries {rebus.base} | R Documentation |
BOUNDARY
matches a word boundary.
whole_word
wraps a regex in word boundary tokens to match a whole
word.
BOUNDARY NOT_BOUNDARY whole_word(x)
x |
A character vector. |
An object of class regex
(inherits from character
) of length 1.
A character vector representing part or all of a regular expression.
http://www.regular-expressions.info/wordboundaries.html and http://www.rexegg.com/regex-boundaries.html
BOUNDARY NOT_BOUNDARY # Usage x <- c("the catfish miaowed", "the tomcat miaowed", "the cat miaowed") (rx_before <- BOUNDARY %R% "cat") (rx_after <- "cat" %R% BOUNDARY) (rx_whole_word <- whole_word("cat")) stringi::stri_detect_regex(x, rx_before) stringi::stri_detect_regex(x, rx_after) stringi::stri_detect_regex(x, rx_whole_word)