title: Java regular expression escaped commas
body: <p>I have a csv file that I would like to use the <code>String split()</code> method on. I want each element of the array returned by <code>split()</code> to be the comma separated values in the csv. However, there are other commas in the csv file. </p>
  
  <p>Fortunately, these other commas are escaped like <code>'\,'</code></p>
  
  <p>I am having trouble getting the right regex for the <code>split()</code> method. I want to split by commas that are not preceded by the escape character.</p>
  
  <p>My current code is:</p>
  
  <pre><code>String[] columns = new String[CONST];
  columns = someString.split("*^\\,*");
  </code></pre>
  
  <p>To me this says: split by a comma but the character before the comma must not be the escape character. Any number of characters before or after the comma are allowed.</p>
  
  <ol>
  <li>How do I get the correct regular expression?</li>
  </ol>