[EMAIL PROTECTED] (Perl-Krackedpress) writes:

> // check the email fields for validity
>         "^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$"

That will invalidate lots of proper email addresses.  For example
anything in the .info domain.  

For example [EMAIL PROTECTED] is also a valid email
address (which your regexp won't allow).

> // check zipcodes for validity  - but not the last 4 business digits
>       "(^[0-9]{5})-([0-9]{4}$)", trim($zip_code)) &&
> (!ereg("^[a-zA-Z][0-9][a-zA-Z][[:space:]][0-9][a-zA-Z][0-9]$"
> 
> // check phone for validity
>         "(^(.*)[0-9]{3})(.*)([0-9]{3})(.*)([0-9]{4}$)"

I see you are not planning to do much business with people outside
Canada or the US.  How about people with an extension?

Checking phone numbers, street addresses and zipcodes for validity
will pretty much never work.  It's better to assume that the person
entering the information know how it's best expressed.

Let me include a related joke I posted on the Los Angeles Perl Mongers
list a few days ago when someone tried coming up with similar
regexp's.


"Recently, a worldwide survey was conducted by the U.N.

The question was asked, "Would you please give your opinion about the
food shortage in the rest of the world?"


The survey was a huge failure.

In Africa they did not know what 'food' meant.
In Western Europe, they did not know what 'shortage' meant.
In Eastern Europe they did not know what 'opinion' meant.
In South America they did not know what 'please' meant.
And in the U.S. they did not know what 'the rest of the world' meant."


;-)


 - ask

-- 
ask bjoern hansen, http://www.askbjoernhansen.com/ !try; do();

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to