0

Given the following:

# 123456789X12345678  # locator numbers for reference
 "TESTHEHEHETESTHEHE"

I would like to locate all positions of the string "HEHE". The desired output would be 5, 7, and 15. The trouble is the immediate "repeat" of "HEHE" after position #5. So if I use stringr::str_locate_all, I get:

stringr::str_locate_all("TESTHEHEHETESTHEHE", "HEHE")
[[1]]
     start end
[1,]     5   8
[2,]    15  18

Which misses the match beginning at position #7.

JasonAizkalns
  • 20,243
  • 8
  • 57
  • 116

0 Answers0