Learn R Programming

campfin (version 1.0.11)

rx_break: Form a word break regex pattern

Description

Wrap a word in word boundary (\\b) characters. Useful when combined with stringr::str_which() and stringr::str_detect() to match only entire words and not that word inside another word (e.g., "sting" and "testing").

Usage

rx_break(pattern)

Value

The a glue vector of pattern wrapped in \\b.

Arguments

pattern

A regex pattern (a word) to wrap in \\b.

Examples

Run this code
rx_break("test")
rx_break(state.abb[1:5])

Run the code above in your browser using DataLab