javascript - regex pattern for max length 12 -
i need regex pattern max length 12 , should not accept 0 if entered user.
my current pattern not working. here is:
[0-9]{0,12}
any suggestions welcome , explanation of pattern.
^[1-9]{0,12}$
means 12 digits (excluding 0), left emtpy allowed.
if field required, change minimun 1, ^[1-9]{1,12}$
and way, ^
, $
means start , end of input string.
if regexp [1-9]{1,12}
, without ^
, $
, "abc123def"
allowed because center part 123
matched.
Comments
Post a Comment