note 40249 deleted from function.ereg by nlopess
| From: | nlopess@php.net | Date: | Wed, 14 Apr 2004 14:25:03 +0000 |
| Subject: | note 40249 deleted from function.ereg by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-68119@lists.php.net to get a copy of this message | ||
Note Submitter: andreas.schmeiler@rtlnewmedia.de
----
here's a regexp to perform a basic syntax validation on an E-Mailadress:
if (ereg("^([A-Za-z_\.]*)@([A-Za-z_]*)\.([A-Za-z_\.]*)$", $string)) {
print "valid";
} else {
print "invalid";
}
this verfies that $string
+ contains exactly one "@"
+ name and domain consists of numbers,letters, "." or "_"
+ there is at least one "." within the domain name