title: Regex to include negative numbers in java
body: <p>In this program I'm parsing input into integers and I can't seem to be able to take in negative numbers and have tried a bunch of regular expressions. I can get positive integers no problem by removing the &amp;&amp;^- it's just the negative integers I'm having problems with.</p>
  
  <p>Example:</p>
  
  <pre><code>input = console.readLine("?&gt; ").split("\\D+&amp;&amp;^-");
  </code></pre>
  
  <p>Any idea and what I'm doing wrong? Thanks for any help in advance.</p>
  
  <p>Sample input:
  -7 * 4</p>
  
  <p>Output:
  -7 and 4 should be stored into an array of strings.</p>