note 95979 deleted from function.ereg by thiago
| From: | thiago@php.net | Date: | Mon, 01 Feb 2010 12:49:48 +0000 |
| Subject: | note 95979 deleted from function.ereg by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165559@lists.php.net to get a copy of this message | ||
Note Submitter: zzz15 at op dot pl
----
Here's an extended pattern for email veritication:
<?php
if (!eregi("^([a-z]{1})([a-z0-9]*)([\.|_|-]?)([a-z0-9]*)([@]{1})
([a-z0-9]*)([\.|_|-]?)([a-z0-9]*)([\.]{1})([a-z]{2,5})$",$email)) print "Invalid
email!";
else print "all is ok!<br />$email";
?>
It's true for:
aa@aa.aa
aa.aa@aa.aa
aa_aa@aa.aa
aa-aa@aa.aa
aa@aa.aa.aa
aa@aa-aa.aa
aa@aa_aa.aa
aa.aa@aa.aa.aa
aa-aa@aa.aa.aa
... you get the picture.
Anything else will return error message.
I thought it'd be a nice addition to add test for numbers dashes, underscore and dots at the
beginning of email.