title: Java String.split() sometimes giving blank strings
body: <p>I'm making a text based dice roller. It takes in strings like "2d10+5" and returns a string as a result of the roll(s). My problem is showing up in the tokenizer that splits the string into useful parts for me to parse into information.</p>
  
  <p><code>String[] tokens = message.split("(?=[dk\\+\\-])");</code> </p>
  
  <p>This is yielding strange, unexpected results. I don't know exactly what is causing them. It could be the regex, my misunderstanding, or Java just being Java. Here's what's happening: </p>
  
  <ul>
  <li><code>3d6+4</code> yields the string array <code>[3, d6, +4]</code>. This is correct.</li>
  <li><code>d%</code> yields the string array <code>[d%]</code>. This is correct.</li>
  <li><code>d20</code> yields the string array <code>[d20]</code>. This is correct.</li>
  <li><code>d%+3</code> yields the string array <code>[, d%, +3]</code>. This is incorrect. </li>
  <li><code>d20+2</code> yields the string array <code>[, d20, +2]</code>. This is incorrect. </li>
  </ul>
  
  <p>In the fourth and fifth example, something strange is causing an extra empty string to appear at the front of the array. It's not the lack of number at the front of the string, as other examples disprove that. It's not the presence of the percentage sign, nor the the plus sign. </p>
  
  <p>For now I'm just continuing through the for loop on blank strings, but that feels sorta like a band-aid solution. Does anyone have any idea what causes the blank string at the front of the array? How can I fix it?</p>