title: java String replace method works but throwing error with replaceAll
body: <p>I have a string andn I want to replace { to \{ ... When I use replace method then it works but when I use replaceAll then it is giving error like <code>Illegal repetition</code>
  What is the reason?</p>
  
  <pre><code>String s = "One{ two } three {{{ four}";
  System.out.println(s.replace("{", "\\{"));
  System.out.println(s.replaceAll("{", "\\{"));
  </code></pre>
  
  <p>Expected output is - One\{ two } three \{\{\{ four}</p>