title: Forward slash in Java Regex
body: <p>I can't figure out why the following code doesn't behave as expected</p>
  
  <pre><code>"Hello/You/There".replaceAll("/", "\\/");
  </code></pre>
  
  <ul>
  <li>Expected output: <code>Hello\/You\/There</code></li>
  <li>Actual output: <code>Hello/You/There</code></li>
  </ul>
  
  <p>Do I need to escape forward slashes? I didn't think so but I also tried the following against my will ... didn't work</p>
  
  <pre><code>"Hello/You/There".replaceAll("\\/", "\\/");
  </code></pre>
  
  <p>In the end I realized I don't need a regular expression and I can just use the following, which doesn't create a regular expression</p>
  
  <pre><code>"Hello/You/There".replace("/", "\\/");
  </code></pre>
  
  <p>However, I'd still like to understand why my first example doesn't work.</p>