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

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -