validation - validate numbers by limitation in length and true decimal format -


i want validate numbers regular expression.
valid numbers are:

123456789012345.123 

or

123.9 

or

0.686` 

before decimal point must 1 maximum 15 numbers , after must maximum 3 numbers; , negative numbers optional.

invalid numbers are:

0.0 0.00 0.000 000 097654 05978.7 .657665 5857. 

i found regex can,t set numbers length limitation:

 ^-?(([1-9]\d*)|0)(\.0*[1-9](0*[0-9])*)?$ 

in place of * use {a,b} minimum number of preceding , b maximum. omit or b no minimum / maximum.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -