regular expression for number and decimal points in javascript
<p>I have checked the below link  for regular expression</p>

<p><a href="https://stackoverflow.com/questions/1014284/regex-to-match-2-digits-optional-decimal-two-digits">Regex to match 2 digits, optional decimal, two digits</a></p>

<p>regular expression should accept whole number or decimal points. max length should be 10 numbers before decimal and 4 digits after decimal.</p>

<p>tried this below code from above link (2 digit decimal point)</p>

<pre><code>\d{0,2}(\.\d{1,2})?

var patt =new RegExp("\d{0,2}(\.\d{1,2})?")
undefined
patt.test(1)
true
patt.test(1.1)
true
patt.test(11)
true
patt.test(111.111)
true
</code></pre>

<p>for 3 digits after decimal also it is giving true value, which is invalid.</p>