Wednesday 15 April 2015

regex - Regular expression for number in JavaScript -



regex - Regular expression for number in JavaScript -

i want regular look numbers, not less 3 , more 7 digit , should not take characters.

i tried (/^[0-9]{3,7}$/) - accepting character 'e'. eg: 1e3, 23e4, 123e4 failing.

my guess 1e3 number written in engineering notation, not string. e means "times 10 powerfulness of", 1e3 means 1 x 10^3 = 1000, , 23e4 means 230000. if case, when convert number 1e3 string, output "1000", represents number not less 3 digits , not more 7, right regex matches this.

javascript regex

No comments:

Post a Comment