title: Replace Pattern match with Preferred Text Java
body: <p>Hey I am trying to replace the a regex pattern in a directory of files and replace with this character 'X'. I started out trying alter one file but that is not working. I cam eup with the following code any help would be appreciated.</p>
  
  <p>My goal is to read all the file content find the regex pattern and replace it.</p>
  
  <p>Also this code is not working it runs but dose nothing to the text file.</p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  import org.apache.commons.io.FileUtils;
  
  public class DataChange {
       public static void main(String[] args) throws IOException {
  
           String absolutePathOne = "C:\\Users\\hoflerj\\Desktop\\After\\test.txt";
           String[] files = { "test.txt" };
           for (String file : files) {
               File f = new File(file);
               String content = FileUtils.readFileToString(new File(absolutePathOne));
               FileUtils.writeStringToFile(f, content.replaceAll("2018(.+)", "X"));
           }
      }
  }
  </code></pre>
  
  <p>File Content inside the file is: </p>
  
  <blockquote>
    <p>3-MAAAA2017/2/00346 </p>
  </blockquote>
  
  <p>I am trying to have it read through and replace 2017/2/00346 with XXX's
  my goal is to do this for like 3 files at one time also.</p>