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

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -