You could use Regex.Replace(String, String, Int32)
for this, execute until all of the intended replacements from arr
are replaced.
var text = File.ReadAllText("file.txt");
var arr = new[] { "A", "B", "A" };
var regex = new Regex("b");
for(int i = 0; i < arr.Count; i++)
text = regex.Replace(text, arr[i].ToString(), 1);
Tip: Never answer when tired…
solved replace string by index of this string [closed]