title: Java vs JavaScript split behavior
body: <p>The split functionality seems to be different between Java and JavaScript. </p>
  
  <p>I do not exactly need to match a certain regular expression criteria, or use 
  lookahead based regex. My problem resides with empty matches being trailed after final matching of the split regex ( which is a simple set of character and not an expression ). </p>
  
  <p>Below is an example of the output I am trying to achieve and what am I really getting. </p>
  
  <p><strong>Java</strong></p>
  
  <pre><code>("~#~~#~~#~A~#~B~#~C~#~D~#~E~#~~#~~#~").split("~#~")
  
  /* results with an array of length 8 */ (java.lang.String[]) [, , , A, B, C, D, E]
  </code></pre>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code> "~#~~#~~#~A~#~B~#~C~#~D~#~E~#~~#~~#~".split("~#~")
   /* results with an array of length 11 */ ["", "", "", "A", "B", "C", "D", "E", "", "", ""]
  </code></pre>
  
  <p>I really can't put my hands on a good explanation for this as I am working with a Java application and the split is causing me trouble, I want the same result as in JavaScript. How can I get that?</p>