Try as below.
string MResult = "hdshdjshdjsinputhdjshdjhdINPUTDHSJHDJInputdhsdjshdjhdj";
string search = txtSearch.Text;
string replaceWith = "1234";
MResult = System.Text.RegularExpressions.Regex.Replace(MResult, search, replaceWith, System.Text.RegularExpressions.RegexOptions.IgnoreCase);