title: Regular expression for numbers and one decimal
body: <p>I can't seem to get a simple regular expression to work.  Here's what I have at the moment:</p>
  <pre><code>$(&quot;.Hours&quot;).on('input', function (e) {
  
      var regex = /^\d+(\.\d{0,2})?$/g;
  
      if (!regex.test(this.value)) {
          if (!regex.test(this.value[0]))
              this.value = this.value.substring(1, this.value.length);
          else
              this.value = this.value.substring(0, this.value.length - 1);
      }
  });
  </code></pre>
  <p>I need the user to be able to only enter numbers and one decimal (with only two numbers after the decimal). It's working properly now, with the exception that a user cannot start with a decimal.</p>
  <p>Acceptable:</p>
  <pre><code>23.53
  0.43
  1111.43
  54335.34
  235.23
  .53 &lt;--- Not working 
  </code></pre>
  <p>Unacceptable:</p>
  <pre><code>0234.32 &lt;--- The user can currently do this
  23.453
  1.343
  .234.23
  1.453.23
  </code></pre>
  <p>Any help on this?</p>