M
Mark B
What would the regular expression syntax be to validate that a field's input
is simply any integer number >=1?
is simply any integer number >=1?
What would the regular expression syntax be to validate that a field's input
is simply any integer number >=1?
Mark, here it is: ^\d+$
Mark, here it is: ^\d+$
Anon User wrote :
Mark, here it is: ^\d+$
not quite, as that would allow "0", which was not the question.
use: ^[1-9]\d*$
this does not allow leading zeroes or a single zero.
Hans Kesting
What would the regular expression syntax be to validate that a field's input
is simply any integer number >=1?
Hans said:Anon User wrote :Mark, here it is: ^\d+$
not quite, as that would allow "0", which was not the question.
use: ^[1-9]\d*$
this does not allow leading zeroes or a single zero.
Andrew Morton said:Hans said:Anon User wrote :What would the regular expression syntax be to validate that a
field's input is simply any integer number >=1?
Mark, here it is: ^\d+$
not quite, as that would allow "0", which was not the question.
use: ^[1-9]\d*$
this does not allow leading zeroes or a single zero.
But 007 satisfies the OP's requirement...
Andrew
Thanks all.
Actually we wouldn't want 007. It's just a text field on a page for
the user to enter the number of users they want their software license
to cover.
I can't bring myself to put an upper limit on it (e.g. using the range
validator) so I decided to go for ^[1-9]\d*$.
But 007 satisfies the OP's requirement...Hans said:Anon User wrote :
What would the regular expression syntax be to validate that a
field's input is simply any integer number >=1?
Mark, here it is: ^\d+$
not quite, as that would allow "0", which was not the question.
use: ^[1-9]\d*$
this does not allow leading zeroes or a single zero.
Andrew
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.