str_locate_all {stringr}R Documentation

Locate the position of all occurences of a pattern in a string.

Description

Locate the position of all occurences of a pattern in a string.

Usage

str_locate_all(string, pattern)

Arguments

string input character vector
pattern pattern to look for. See regex for description.

Value

list of numeric matrices. First column gives start postion of match, and second column gives end position.

See Also

regexpr which this function wraps

str_extract for a convenient way of extracting matches

str_locate to locate position of first match

Examples

fruit <- c("apple", "banana", "pear", "pinapple")
str_locate_all(fruit, "a")
str_locate_all(fruit, "e")

[Package stringr version 0.2 Index]