using System.Collections.Generic;
public static class Program
public static string basetext="Hi, this is ##### reaching out to you to get the information about #####. Please call us at ##### for more information";
public static void Main()
List<int> indexes = basetext.AllIndexesOf("####");
string newstring = basetext;
var aStringBuilder = new StringBuilder(newstring);
for(int i=indexes.Count -1 ;i>=0;i--)
aStringBuilder.Remove(indexes[i],5);
aStringBuilder.Insert(indexes[i],"<input type='text' id='Item'"+i.ToString()+" style='font-weight:600;width:100px;border-top:white;border-right:white;border-left:white;text-align:center' />");
Console.Write(aStringBuilder.ToString());
public static List<int> AllIndexesOf(this string str, string value)
if (String.IsNullOrEmpty(value))
throw new ArgumentException("the string to find may not be empty", "value");
List<int> indexes = new List<int>();
for (int index = 0;; index += value.Length)
index = str.IndexOf(value, index);