title: Regular expression for validating decimal numbers
body: <pre>
  function validateDecimal(number,maxDigits)
  {
      eval("var stringvar=/^[-+]?([0-9]*\.[0-9]{0,"+maxDigits+"})|([0-9]+)$/");
  
      return stringvar.test(number);
  }
  </pre>
  
  <p>I wrote above function to validate decimal numbers. The variable 'maxDigits' uses to specify the number of digits in fractional part and 'number' as the value to be validated. But it returned 'true' when I tried with a numeric value followed by a character for eg: 24y. Can anyone help me to figure out my mistake.</p>