str_locate_nth(string, pattern, n)locate_nth(string, pattern, n)
str_locate_first(string, pattern)
locate_first(string, pattern)
str_locate_last(string, pattern)
locate_last(string, pattern)
A character vector.
The pattern to look for.
The default interpretation is a regular expression, as described in stringi::stringi-search-regex.
To match a without regular expression (i.e. as a human would), use
coll(). For details see stringr::regex()
.
A vector of integerish values. Must be either length 1 or
have length equal to the length of string
. Negative indices count from
the back: while n = 1
and n = 2
correspond to first and second, n = -1
and n = -2
correspond to last and second-last. n = 0
will return
NA
.