title: Java Regular Expressions with Math Operators
body: <p>I have a conundrum, I need to separate a possible varied math string into separate entities to store in an ArrayList.</p>
  
  <p>Input is read from a scanner could be any of the following.</p>
  
  <pre><code>Scanner input = new Scanner(System.in);
  String read = input.nextLine();
  ArrayList al = new ArrayList();
  
  -5 + 10 //possible value of read
  9--5   //possible value of read
  -20* 10 //possible value of read
  </code></pre>
  
  <p>Basically I need to grab the first number and a potential negative sign, all ignoring leading or trailing whitespace and store it, then take the next character ignoring whitespace and store it (the operator of the problem), and then the next number with an optional negative sign, again ignoring whitespace.</p>
  
  <p>I'm not very good with regex, and there's a lot of complicated possibilities here that I don't know how to tackle.</p>
  
  <p>If I had to lay it out logically, I would say it thusly:</p>
  
  <p>Get first non-whitespace character and end at last number digit that directly follows it.</p>
  
  <p>Get next non-whitespace character</p>
  
  <p>Get next non-whitespace character and end at last number digit that directly follows it.</p>
  
  <p>Any pointers on syntax to accomplish that?</p>
  
  <p>EDIT:  I'm not simply trying to evualuate the result of the expression in question, I need to break it up and store it in an ArrayList to manipulate later as part of a Fraction Class.</p>