title: Handling delimiter with escape characters in Java String.split() method
body: <p>I have searched the web for my query, but didn't get the answer which fits my requirement exactly.  I have my string like below:</p>
  
  
  
  <pre class="lang-none prettyprint-override"><code>A|B|C|The Steading\|Keir Allan\|Braco|E
  </code></pre>
  
  <p>My Output should look like below:</p>
  
  <pre class="lang-none prettyprint-override"><code>A
  B
  C
  The Steading|Keir Allan|Braco
  E
  </code></pre>
  
  <p>My requirement is to skip the delimiter if it is preceded by the escape sequence.  I have tried the following using negative lookbehinds in <code>String.split()</code>:</p>
  
  <pre class="lang-none prettyprint-override"><code>(?&lt;!\\)\|
  </code></pre>
  
  <p>But, my problem is the delimiter will be defined by the end user dynamically and it need not be always <code>|</code>. It can be any character on the keyboard (no restrictions).  Hence, my doubt is that the above regex might fail for some of the special characters which are not allowed in regex.</p>
  
  <p>I just wanted to know if this is the perfect way to do it.</p>