Home > Mobile >  RegEx for decimal number with maximum length Zero not woking
RegEx for decimal number with maximum length Zero not woking

Time:08-15

I am trying to create a regex to have a number only stat from 1 and max length without decimal 10, I try this regex ^[1-9]{1,10}([,.][0-9]{0,2})?$

now facing issue after type 1 zero not accepting.

CodePudding user response:

You might write the pattern as starting with [1-9] and repeat 0-9 times a digit [0-9] for the total of 10 digits.

^[1-9][0-9]{0,9}([,.][0-9]{0,2})?$
  • Related