powered by
str_locate_all(string, pattern)
regex
string
pattern
regexpr
str_extract for a convenient way of extracting matches
str_extract
str_locate to locate position of first match
str_locate
fruit <- c("apple", "banana", "pear", "pineapple") str_locate_all(fruit, "a") str_locate_all(fruit, "e")
Run the code above in your browser using DataLab