RE: [PEAR-DEV] Quickform nonzero rule bug (?)
| From: | David Sklar | Date: | Wed, 25 Jun 2003 15:46:25 +0000 |
| Subject: | RE: [PEAR-DEV] Quickform nonzero rule bug (?) | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-17708@lists.php.net to get a copy of this message | ||
On Wednesday, June 25, 2003 11:45 AM, mailto:george@omniti.com wrote:
> On Wednesday, June 25, 2003, at 11:07 AM, David Sklar wrote:
>> I think /^-?[1-9][0-9]*$/ is clearer if the name of the rule is
>> "nonzero" but if you don't want to change it (and you're right, it
>> is easy to use 'regex' instead) then just make sure it's clear in
>> the documentation what the "nonzero" rule does.
>
>
> Just out of curiosity, what is the point of this validation? I only
> ask because I've seen people use this to validate us zipcodes, which
> does not work (there are some that begin with zero).
I like /^\d{5}(-\d{4})?$/ for US ZIP codes. I am not sure what the nonzero
rule as is currently in the code is useful for. /^-?[1-9][0-9]*$/ could be
useful for a value that's meant to be an adjustment or delta for an existing
value.
David