Re: RES: [PHP] email address syntax checker
| From: | ash@ashleysheridan.co.uk | Date: | Fri, 21 Jan 2011 11:38:27 +0000 |
| Subject: | Re: RES: [PHP] email address syntax checker | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-310949@lists.php.net to get a copy of this message | ||
That won't accept dozens of different types of email addresses. It won't even match some
value domains.
Valid email addresses can contain virtually any character in the local part (although in the main
they will require being inside quotation marks), and the @ symbol is included in that!
Thanks,
Ash
http://www.ashleysheridan.co.uk
----- Reply message -----
From: "Alejandro Michelin Salomon" <amichelins@hotmail.com>
Date: Fri, Jan 21, 2011 12:14
Subject: RES: [PHP] email address syntax checker
To: "'Donovan Brooke'" <lists@euca.us>
Cc: <php-general@lists.php.net>
Donovan:
Try this
function EmailCheck ( $sEmail )
{
$regexp="/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z
]{2,}$/i";
if ( !preg_match($regexp, $sEmail) )
return false;
return true;
}
Alejandro M.S.
-----Mensagem original-----
De: Donovan Brooke [mailto:lists@euca.us]
Enviada em: quinta-feira, 20 de janeiro de 2011 01:14
Para: php-general@lists.php.net
Assunto: [PHP] email address syntax checker
Hi Guys,
I'm waddling my way through database interaction and thought someone on
the list may already have a simple email checker that they'd like to
share...
you know, looking for the @ char and dots etc..
I did a quick search of the archives and found a couple elaborate
things.. but
I'm looking for something simple. This job will have trusted users and
the checker is more to help them catch mistakes when registering.
Thanks!,
Donovan
--
D Brooke
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php