title: How to validate floating number in [input type=text]
body: <p>I need a regular expression which validate the floating point number, I have build the following.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;label for="salary"&gt;Enter floating nunmber:&lt;/label&gt;
  &lt;input type="text" id="salary" name="salary" oninput="this.value = this.value.replace(/[^-0-9.]/g, '').replace(/(\..*)\./g, '$1').replace(/(\-.*)\-/g, '$1');" /&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>It works but it fails in case of <code>11-111</code>. How to I fix it.</p>