title: c# replace string in a text file
body: <p>I am trying to replace string in a text file. </p>
  
  <p>I use the following code:</p>
  
  <pre><code>string text = File.ReadAllText(@"c:\File1.txt");
  text = text.Replace("play","123");
  File.WriteAllText(@"c:\File1.txt", text);
  </code></pre>
  
  <p>It not only changes the word "play" to "123" but also change the word "display" to "dis123"</p>
  
  <p>How to fix this problem?</p>