stri_locate_all('stringi', fixed='i')
stri_locate_first_coll('hladn\u00FD', 'HLADNY', strength=1, locale='sk_SK')
stri_locate_all_regex(
c('breakfast=eggs;lunch=pizza', 'breakfast=spam', 'no food here'),
'(?\\w+)=(?\\w+)',
capture_groups=TRUE
) # named capture groups
stri_locate_all_fixed("abababa", "ABA", case_insensitive=TRUE, overlap=TRUE)
stri_locate_first_fixed("ababa", "aba")
stri_locate_last_fixed("ababa", "aba") # starts from end
stri_locate_last_regex("ababa", "aba") # no overlaps, from left to right
x <- c("yes yes", "no", NA)
stri_locate_all_fixed(x, "yes")
stri_locate_all_fixed(x, "yes", omit_no_match=TRUE)
stri_locate_all_fixed(x, "yes", get_length=TRUE)
stri_locate_all_fixed(x, "yes", get_length=TRUE, omit_no_match=TRUE)
stri_locate_first_fixed(x, "yes")
stri_locate_first_fixed(x, "yes", get_length=TRUE)
# Use regex positive-lookahead to locate overlapping pattern matches:
stri_locate_all_regex('ACAGAGACTTTAGATAGAGAAGA', '(?=AGA)')
# note that start > end here (match of length zero)
Run the code above in your browser using DataLab