Fix performance issue in IndexesOf action

Switch from using IndexOf and LastIndexOf to Regex.Matches