title: Allowing negative and positive decimals in javascript.replace
body: <p>I am using this to filter out everything that isn't a number (including decimals)</p>
  
  <p>On keydown I am doing this:</p>
  
  <pre><code>function validateNudgerInput(ele){
            ele.val(ele.val().replace(/[^0-9\.]/g,''));
              if (parseFloat(ele.val())&gt; settings.max
                ||parseFloat(ele.val())&lt; settings.min)
              {
                ele.addClass("nudgerInvalid ")
              }else{
               ele.removeClass("nudgerInvalid")
              }
          }
  </code></pre>
  
  <p>Currently Using: 
  <code>ele.val(ele.val().replace(/[^0-9\.]/g,''));</code>
  This strips out anything that isnt a number above zero (decimals allowed) -i.e. If a user presses the "A" key, it will stop this from being placed in the textbox</p>
  
  <p>How would I adapt this to allow negative numbers too? (Allowing the - sign)</p>
  
  <p>Examples of valid input:
  <code>1</code>
  <code>-1</code> 
  <code>123.45</code>
  <code>-123.45</code></p>