title: Replace variable having backslach
body: <p>The purpose of code is to replace value by another value for a configuration file. </p>
  
  <p>The old value is assigned to a variable <strong>oldValue</strong>="serverip=http://82.347.34.12"</p>
  
  <p>The new value is assigned to another variable <strong>newValue</strong>="serverip=http://99.347.34.12"</p>
  
  <pre><code>void searchFile(File nameOfFile, String oldValue, String newValue) throws IOException {
      try {
  
                  System.out.println("Old setting: " + lines); // returns -&gt; serverip=http:\/\/82.347.34.12
                  System.out.println("New setting: " + settingToApply); // returns --&gt; serverip=http:\/\/99.347.34.12
  
                  Path path = Paths.get(SETTINGS);
                  Charset charset = StandardCharsets.UTF_8;
  
                  String content = new String(Files.readAllBytes(path), charset);
  
                  // changes any cases correctly except when value have \
                  content = content.replaceAll(oldValue, newValue); 
                  Files.write(path, content.getBytes(charset));
  
          }
  
          scanner.close();
      } catch (FileNotFoundException e) {
          // handle this
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Thank you.</p>