title: replaceAll "|" by "$" in java
body: <p>I have tried to replace all "|" by "2" using following code:</p>
  
  <pre><code> String myString = "I want to change | with 2";
   String trimedString = myString.replaceAll("|", "2");
   System.out.print(trimedString);
  </code></pre>
  
  <p>My expected output was:</p>
  
  <pre><code>"I want to change | with 2"
  </code></pre>
  
  <p>But real output was:</p>
  
  <pre><code>"2I2 2w2a2n2t2 2t2o2 2c2h2a2n2g2e2 2|2 2w2i2t2h2 222"
  </code></pre>
  
  <p>It added 2 before and after each char. What is the correct way of doing this?</p>