title: Replace substring (replaceAll) workaround
body: <p>I'm trying to replace a substring that contains the char "$". I'd be glad to hear why it didnt works that way, and how it would work.</p>
  
  <p>Thanks,
  user_unknown</p>
  
  <pre><code>public class replaceall {
      public static void main(String args[]) {
          String s1= "$foo - bar - bla";
          System.out.println("Original string:\n"+s1);
          String s2 = s1.replaceAll("bar", "this works");
          System.out.println("new String:\n"+s2);
          String s3 = s2.replaceAll("$foo", "damn");
          System.out.println("new String:\n"+s3);
      }
  
  }
  </code></pre>