title: How to split a comma separated String while ignoring escaped commas?
body: <p>I need to write a extended version of the StringUtils.commaDelimitedListToStringArray function which gets an additional parameter: the escape char.</p>
  
  <p>so calling my:</p>
  
  <pre><code>commaDelimitedListToStringArray("test,test\\,test\\,test,test", "\\")
  </code></pre>
  
  <p>should return:</p>
  
  <pre><code>["test", "test,test,test", "test"]
  </code></pre>
  
  <p><br><br>
  My current attempt is to use String.split() to split the String using regular expressions:</p>
  
  <pre><code>String[] array = str.split("[^\\\\],");
  </code></pre>
  
  <p>But the returned array is:</p>
  
  <pre><code>["tes", "test\,test\,tes", "test"]
  </code></pre>
  
  <p>Any ideas?</p>