title: Text cleaning and replacement: delete \n from a text in Java
body: <p>I'm cleaning an incoming text in my Java code. The text includes a lot of "\n", but not as in a new line, but literally "\n". I was using replaceAll() from the String class, but haven't been able to delete the "\n".
  This doesn't seem to work:</p>
  
  <pre><code>String string;
  string = string.replaceAll("\\n", "");
  </code></pre>
  
  <p>Neither does this:</p>
  
  <pre><code>String string;
  string = string.replaceAll("\n", "");
  </code></pre>
  
  <p>I guess this last one is identified as an actual new line, so all the new lines from the text would be removed. </p>
  
  <p>Also, what would be an effective way to remove different patterns of wrong text from a String. I'm using regular expressions to detect them, stuff like HTML reserved characters, etc. and replaceAll, but everytime I use replaceAll, the whole String is read, right?</p>
  
  <p><strong>UPDATE</strong>: Thanks for your great answers. I' ve extended this question here:<br>
  <a href="https://stackoverflow.com/questions/542770/text-replacement-efficiency">Text replacement efficiency</a><br>
  I'm asking specifically about efficiency :D</p>