I have a set of requirements which state that the input must be validated as follows:
Currently I have ^(?!0{1,7}$)(\d+(\.\d)?){1,7}$
But this does not limit the overall string to a maximum of 7 characters
We can think this way:
^(?=\d+(?:\.\d+)?$)(?![0\.]+$).{1,7}$
.
symbol (number pattern)0
and .
symbols (pattern to exclude 0 value). If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With