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+$
Alexey Smirnov 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:Alexey Smirnov 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:Alexey Smirnov 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:Alexey Smirnov 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