title: Replace a "new line" char with regex in C#
body: <p>I want to locate every string in a text file that contains the sequence "letter or number", "new line", "letter or number" then replace the "new line" with a "space".</p>
  
  <p>This is what I've tried so far :</p>
  
  <pre><code>private void button3_Click(object sender, EventArgs e)
  {
       string pathFOSE = @"D:\Public\temp\FOSEtest.txt";     
       string output = Regex.Replace(pathFOSE, @"(?&lt;=\w)\n(?=\w)", " ");                      
  
       string pathNewFOSE = @"D:\Public\temp\NewFOSE.txt";
       if (!System.IO.File.Exists(pathNewFOSE))
       {
            // Create a file to write to. 
            using (System.IO.StreamWriter sw = System.IO.File.CreateText(pathNewFOSE))
            {                
            }
       File.AppendAllText(pathNewFOSE, output);
       }
  }
  </code></pre>
  
  <p>But all my program does is create a new text file, containing only this line <code>"D:\Public\temp\FOSEtest.txt"</code> </p>
  
  <p>Any idea of what's happening ? Also is <code>\n</code> the correct way of searching for new lines in a text file in Windows7? Thanks</p>
  
  <p><strong>Edit</strong>: I made the change suggested by Avinash and added that I was working on Windows 7.</p>
  
  <p><strong>Edit 2</strong>: I think I need to understand why the <code>Replace</code> is taking place on the path string and not on the file it leads to before trying suggestions.</p>
  
  <p><strong>Final Edit</strong>: Everything is working thanks to stribizhev, I just copy pasted his answer. Thanks to everyone that responded !</p>