Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

WordBoundaries

Word boundaries


Description

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

Usage

BOUNDARY

NOT_BOUNDARY

whole_word(x)

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

See Also

Examples

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)

rebus.base

Core Functionality for the 'rebus' Package

v0.0-3
Unlimited
Authors
Richard Cotton [aut, cre]
Initial release
2017-04-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.