Learn R Programming

RVerbalExpressions (version 0.0.0.9000)

rx_word: Match a word.

Description

Match a word<U+2014>a string of word characters (a<U+2013>z, A<U+2013>Z, 0<U+2013>9 or _). This function is looks for tabs with the following expression: \w+

Usage

rx_word(.data = NULL)

Arguments

.data

Expression to append, typically pulled from the pipe %>%

Examples

Run this code
# NOT RUN {
rx_word()

# create an expression
x <- rx_word()

# create inputs
string1 <- "foo_bar"
string2 <- "foo-bar"

# extract matches
regmatches(string1, regexpr(x, string1))
regmatches(string2, regexpr(x, string2)) # doesn't match -
# }

Run the code above in your browser using DataLab