str_locate_all {stringr} | R Documentation |
Locate the position of all occurences of a pattern in a string.
str_locate_all(string, pattern)
string |
input character vector |
pattern |
pattern to look for. See regex for
description. |
list of numeric matrices. First column gives start postion of match, and second column gives end position.
regexpr
which this function wraps
str_extract
for a convenient way of extracting matches
str_locate
to locate position of first match
fruit <- c("apple", "banana", "pear", "pinapple") str_locate_all(fruit, "a") str_locate_all(fruit, "e")