title: Stripping commas and non-numeric characters from string in javascript
body: <p>should be simple but RegExs never seem to be :). Can anyone help on how to strip both a comma and any non-numeric characters from a string? Thanks. It's in the <code>var result</code> block. Apparently when you put an operator in the number it bombs out.<code>num1</code> and <code>num2</code>. I also need to strip out any dashes.</p>
  
  <pre><code> function calcTotalRetailVal() {
      var num1 = $oneTimeCostField.val();
      var num2 = $recurringTotalCostField.val();
     //In the replace method
      var result = parseFloat(num1.replace(/,/g, '')) + parseFloat(num2.replace(/,/g, ''));
      if (!isNaN(result)) {
          $totalRetailAmountField.text('$' + result.toFixed(2));
      }   
  }
  </code></pre>