title: Regex to identify float or int only for currency
body: <p>I am trying to use regex to ensure the input is a number or a float. If the dollar sign is entered by the user, I want javascript to remove it and return true. If a comma is entered by the user return false.</p>
  
  <p>This is what I tried (however it always returns false):</p>
  
  <pre><code>var validAmount = new RegExp('/[^0-9.]/g');
  validAmount.test(numberAmount); 
  
  if(!validAmount.test(parseFloat(numberAmount))){
     alert("bad Amount");
  }
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>Input: 232 //output: true
  Input: 1212.23 //output:true
  Input: $12.23 //(remove $ sign and output:true)
  Input: a23 //output:false
  Input: 1,000 //(output:false)
  </code></pre>