Find Tokens that Match a Regex
Given a text, find all the tokens that match a regex(es). This function is
particularly useful with replace_tokens
.
match_tokens(x, pattern, ignore.case = TRUE, ...)
x |
A character vector. |
pattern |
Character string(s) to be matched in the given character vector. |
ignore.case |
logical. If |
... |
ignored. |
Returns a vector of tokens from a text matching a specific regex pattern.
with(DATA, match_tokens(state, c('^li', 'ou'))) with(DATA, match_tokens(state, c('^Th', '^I'), ignore.case = TRUE)) with(DATA, match_tokens(state, c('^Th', '^I'), ignore.case = FALSE))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.