Regular expression to match float number pattern
Here is the pattern I am looking to match with. I have started something
like this ^\d{1,}.^\d{1,}$ not sure to complete this.
x
x.x
x cannot be zero (0 or 0.00 are not allowed but can be 1.02 or 0.123)
Length of all x including decimals(if any) should not exceed 11 digits
minimum 1 x is required
only 1 decimal is allowed
this is required field
Note: I am referring x as digit
I would like to use this RegEx both in HTML5 Pattern attribute and in
JavaScript string.match("")
clarity: I mean "1.02" is allowed, but "0" or "0.0" is not allowed
No comments:
Post a Comment