This method will count from the left, how many indexes it takes before it matches it's first occurrence of the regex pattern
String - Input, Again, we'll be using them in a loop seperately "123 apple St.", "1A banana Ave 43", "Water Melon Park"
Regex - We'll use the same regex as our last example in RegexReplace, as our result showed that "Kiwi" appeared at the 4th, 3rd and 3rd indexes, our result in this method is expected to be "3 2 2" with regex: "\s\w+\s" (The index starts from 0!)
"3 2 2", as expected, it gave us the index of where the pattern started from the first match for each of our 3 streets.
The quoted methods and descriptions are borrowed from the documentation in Ashley's System expressions tutorial
Our regex example used is a little bit complicated, they can be a whole lot easier and a whole lot harder too. It did help me to explain a lot of I wanted to cover, so I've attached a capx so you can play around with it as well.