Description Usage Arguments Value Examples
Locate the position of patterns in a string.If the match is of length 0, (e.g. from a special match like $) end will be one character less than start. Vectorised over string and pattern.
1 2 3 | re2_locate(string, pattern, parallel = FALSE, grain_size = 1e+05, ...)
re2_locate_all(string, pattern, parallel = FALSE, grain_size = 1e+05, ...)
|
string |
a character vector |
pattern |
a character vector or pre-compiled regular expressions |
parallel |
use multithread |
grain_size |
a minimum chunk size for tuning the behavior of parallel algorithms |
... |
further arguments passed to |
For re2_locate
, an integer matrix. First column gives start postion of match, and second column gives end position. For re2_locate_all
a list of integer matrices.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | re2_locate("yabba dabba doo", "d")
fruit <- c("apple", "banana", "pear", "pineapple")
re2_locate(fruit, "$")
re2_locate(fruit, "a")
re2_locate(fruit, "e")
re2_locate(fruit, c("a", "b", "p", "p"))
re2_locate_all(fruit, "a")
re2_locate_all(fruit, "e")
re2_locate_all(fruit, c("a", "b", "p", "p"))
# Find location of every character
re2_locate_all(fruit, "\\P{M}")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.