&& (3) Final local NotBeyond, ReplaceByLen ReplaceByLen = len(ReplaceBy) RegExp.Global = FALSE RegExp.Pattern = '\sfrom\s' RegExp.IgnoreCase = TRUE Match = RegExp.Execute(s) NotBeyond = iif(empty(Match.Count), len(Source), Match.Item[0].FirstIndex) RegExp.Global = TRUE RegExp.IgnoreCase = FALSE RegExp.Pattern = SearchFor Match = RegExp.Execute(s) for i = Match.Count - 1 to 0 step -1 if( Match.Item[i].FirstIndex < NotBeyond ) Source = stuff(Source, Match.Item[i].FirstIndex + 1, Match.Item[i].Length, ReplaceBy) NotBeyond = NotBeyond - Match.Item[i].Length + ReplaceBylen endif endfor return Source