| str_nth_instance_indices {filesstrings} | R Documentation |
The nth instance of an pattern will cover a series of character indices. These functions tell you which indices those are.
str_nth_instance_indices(string, pattern, n) str_first_instance_indices(string, pattern) str_last_instance_indices(string, pattern)
string |
A character vector. These functions are vectorized over this argument. |
pattern |
A character vector. Pattern(s) specified like the pattern(s)
in the stringr package (e.g. look at |
n |
Then n for the nth instance of the pattern. |
str_first_instance_indices(...) is just
str_nth_instance_indices(..., n = 1).
str_last_instance_indices(...) is just str_nth_instance_indices(..., n = -1).
A two-column matrix. The ith row of this matrix gives the start
and end indices of the nth instance of pattern in the ith
element of string.
str_nth_instance_indices(c("abcdabcxyz", "abcabc"), "abc", 2)