rx_break: Form a word break regex pattern

View source: R/rx-break.R

rx_breakR Documentation

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)

Arguments

pattern

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

Value

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

Examples

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

campfin documentation built on Oct. 20, 2023, 5:06 p.m.