title: regular expression for valid 2 digit decimal number
body: <p>I want to have a validation in php for price which can be 100 or 100.45
  The 2 decimal places will be optional.</p>
  
  <p>Now the validation should allow only digits.</p>
  
  <p>So far i managed to achieve it</p>
  
  <pre><code>if (!preg_match('/^[0-9]+(\.[0-9]{1,2})?/', "100"))
  {
      echo "Invalid";
  }
  else
  {
      echo "Valid";
  }
  </code></pre>
  
  <p>but the issue here is that it is showing valid even if i enter 100a.00 or 100a or 100.a00</p>
  
  <p>Please help me in fixing it so that only digits are allowed i.e 100 or 100.00 format</p>