WordBoundaries: Word boundaries

Description Usage Arguments Format Value References See Also Examples

Description

BOUNDARY matches a word boundary. whole_word wraps a regex in word boundary tokens to match a whole word.

Usage

1
2
3
4
5

Arguments

x

A character vector.

Format

An object of class regex (inherits from character) of length 1.

Value

A character vector representing part or all of a regular expression.

References

http://www.regular-expressions.info/wordboundaries.html and http://www.rexegg.com/regex-boundaries.html

See Also

ALPHA, BACKSLASH, START

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

richierocks/rebus.base documentation built on May 27, 2019, 8:47 a.m.