In python, I can easily search for the first occurrence of a regex within a string like this:
import re re.search(\"pattern\", \"target_text\")
import re re.search("pattern(?!.*pattern)", "target_text")
or
import re re.findall("pattern", "target_text")[-1]
You can use these 2 approaches.
If you want positions use
positions
x="abc abc abc" print [(i.start(),i.end(),i.group()) for i in re.finditer(r"abc",x)][-1]