title: How can tokenize this string in java?
body: <p>How can I split these simple mathematical expressions into seperate strings?</p>
  
  <p>I know that I basically want to use the regular expression: <code>"[0-9]+|[*+-^()]"</code> but it appears String.split() won't work because it consumes the delimiter tokens as well.</p>
  
  <p>I want it to split all integers: 0-9, and all operators *+-^().</p>
  
  <p>So, <code>578+223-5^2</code></p>
  
  <p>Will be split into:  </p>
  
  <pre><code>578  
  +  
  223  
  -  
  5  
  ^  
  2  
  </code></pre>
  
  <p>What is the best approach to do that?</p>