title: How to use regular expressions to add delimiters?
body: <p>Hi I have a sample log file here:</p>
  
  <pre><code>Jan 1 22:54:17 drop   %LOGSOURCE% &gt;eth1 rule: 7; rule_uid: {C1336766-9489-4049-9817-50584D83A245};
  Jan 1 22:54:22 drop   %LOGSOURCE% &gt;eth1 rule: 7; rule_uid: {C1336766-9489-4049-9817-50584D83A245};
  Jan 1 22:54:23 drop   %LOGSOURCE% &gt;eth1 rule: 7; rule_uid: {C1336766-9489-4049-9817-50584D83A245};
  Jan 1 22:54:41 drop   %LOGSOURCE% &gt;eth1 rule: 7; rule_uid: {C1336766-9489-4049-9817-50584D83A245};
  </code></pre>
  
  <p>The default delimiter is a semi-colon(;) and I want to separate the timestamp and "drop", as well as the "drop" with "%LOGSOURCE%" with that delimiter. I didnt get my expected result. This whole code is to insert the delimiter.) My main idea is to add the log file from a ArrayList into a String(which can use regular expressions according to my current knowledge of Java) and to add the delimiters accordingly.</p>
  
  <p>The error is as shown below:</p>
  
  <p>Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: 
      at testing.Testing.main(Testing.java:31) which starts from the line listString.replaceAll("regex command")</p>
  
  <p>Note: I only tried it with putting the delimiter between the timestamp and "drop" and the error occured. I don't understand how to use regular expressions and I really need help on it!</p>
  
  <pre><code>public class Testing {
  
  public static void main(String[] args) throws FileNotFoundException {
  
      Scanner inFile1 = new Scanner(new File("filename")).useDelimiter(";");
      List&lt;String&gt; temps = new ArrayList&lt;String&gt;();
      String listString = "";
      while (inFile1.hasNext()) {
          // find next line
          String token1 = inFile1.next();
          temps.add(token1);
      }
      inFile1.close();
      for (String s : temps) {
          listString += s + "\t";
          listString.replaceAll(s,([a-zA-Z]{3}\s\d{1,2}\s\d{2}:\d{2}:\d{2})(\s)(drop)));
      }
  
      System.out.println(listString);
  
  }
  </code></pre>