Problem with this is that many people use '+' in email addresses along with
other strange characters (a friend of mine has an apostrophe in her address
at General Electric).

Bottom line, trying to catch all valid email addresses using a regex is a
really ugly thing to try to do.  The one shown here will probably work for
95% or more of them though.

As an aside, underscores in domain names are illegal (more correctly,
underscores in MX-related DNS records are illegal).  As such, you don't
need to have underscore to the right of the @ sign in this regex.

 -d

Previously, Nikhil Goyal said:
> I wrote a similar script of my own... Works fine for me
> 
> function email_valid($email) {
> 
> $pattern="^[0-9a-zA-Z_-]+(\.[0-9a-zA-Z_-]+)*@[0-9a-zA-Z_-]+(\.[0-9a-zA-Z_-]+
> )+$";
>  return ereg($pattern, $email);
>  }
> 
> (returns false if email is not valid, true if it is)

-- 
It's been said that a million monkeys at a million keyboards could produce
the complete works of Shakespeare; now thanks to the Internet, we can say
that this is not true.                       -Unknown

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to