Description Usage Arguments Value See Also Examples
Extract matching patterns from a string. Vectorised over string and pattern.
1 2 3 4 5 | re2_extract(string, pattern, anchor = UNANCHORED, parallel = FALSE,
grain_size = 1e+05, ...)
re2_extract_all(string, pattern, anchor = UNANCHORED, parallel = FALSE,
grain_size = 1e+05, ...)
|
string |
a character vector |
pattern |
a character vector or pre-compiled regular expressions |
anchor |
see |
parallel |
use multithread |
grain_size |
a minimum chunk size for tuning the behavior of parallel algorithms |
... |
further arguments passed to |
A character vector for re2_extract
, and a list for re2_extract_all
.
re2_match
to extract matched groups.
1 2 3 4 5 6 7 8 9 10 11 12 | re2_extract("yabba dabba doo", "(.)")
re2_extract_all("yabba dabba doo", "(.)")
str <- c("Aster", "Azalea x2", "Baby's Breath", "Bellflower")
re2_extract(str, "\\d")
re2_extract(str, "[a-z]+")
re2_extract(str, "\\b\\w{1,3}\\b")
# Extract all matches
re2_extract_all(str, "[A-Za-z]+")
re2_extract_all(str, "\\b\\w{1,3}\\b")
re2_extract_all(str, "\\d")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.