title: What is the best algorithm for arbitrary delimiter/escape character processing?
body: <p>I'm a little surprised that there isn't some information on this on the web, and I keep finding that the problem is a little stickier than I thought.</p>
  
  <p>Here's the rules:</p>
  
  <ol>
  <li>You are starting with delimited/escaped data to split into an array.</li>
  <li>The delimiter is one arbitrary character</li>
  <li>The escape character is one arbitrary character</li>
  <li>Both the delimiter and the escape character could occur in data</li>
  <li>Regex is fine, but a good-performance solution is best</li>
  <li>Edit: Empty elements (including leading or ending delimiters) can be ignored</li>
  </ol>
  
  <p>The code signature (in C# would be, basically)</p>
  
  <pre><code>public static string[] smartSplit(
                           string delimitedData, 
                           char delimiter, 
                           char escape) {}
  </code></pre>
  
  <p>The stickiest part of the problem is the escaped consecutive escape character case, of course, since (calling / the escape character and , the delimiter): ////////, = ////, </p>
  
  <p>Am I missing somewhere this is handled on the web or in another SO question?  If not, put your big brains to work... I think this problem is something that would be nice to have on SO for the public good.  I'm working on it myself, but don't have a good solution yet.</p>