Find the text postions index

I have a text that has this particular repeated multiple times. I want to find the position of all the repeated texts.

E.g
The apple is red is what was declared. I declared the apple is red etc
Repeated like 50 times in more than a 100,000 words text

My codes:
Uses the match regex to match the word
increase = 0
For each match of that word
assign pos = text.IndexOf("+item.ToString+", text.IndexOf("+item.ToString+") + “+increase.ToString+”)
increase = increase + 1
end of loop

However, it isn’t working as expected. Any other suggestions?

Hi @sangasangasanga,
Can please tell me what will you do further with those indexes?

I will use them for substring

With use of regex you should be able to catch the word and work with indexes.
For example if your word has been found like 20 times with regex you can switch between regex output variable like: Regex_output(0), Regex_output(1)… etc.