title: Java Regular Expression to match dollar amounts
body: <p>This is what i've been using</p>
  
  <pre><code>\$?[0-9]+\.*[0-9]*
  </code></pre>
  
  <p>But when i was doing some testing i noticed that things like</p>
  
  <pre><code>$$$34.00 
  </code></pre>
  
  <p>would return as a match (but <code>matcher.group()</code>) just returns the matched substring. I don't want it to even pass the regular expression if the user enters more than one dollar sign so i tried this:</p>
  
  <pre><code>\${1}[0-9]+\.*[0-9]*
  </code></pre>
  
  <p>but this seems to behave the same as the regular expression i first typed. Right now i'm testing this in java but, i plan to use it in c++ using the Boost libraries. But Please don't give me that solution here because i'm trying to learn without someone giving me the answer. </p>
  
  <p>But i do need help making it so the user can only enter one dollar sign (which is what i thought <code>\${1}</code> would do)</p>