note 95979 added to function.ereg
| From: | zzz15 at op dot pl | Date: | Mon, 01 Feb 2010 12:45:08 +0000 |
| Subject: | note 95979 added to function.ereg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165555@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.197
Probable Submitter: 89.74.162.232
----
Manual Page -- http://www.php.net/manual/en/function.ereg.php
Edit -- https://master.php.net/note/edit/95979
Del: integrated -- https://master.php.net/note/delete/95979/integrated
Del: useless -- https://master.php.net/note/delete/95979/useless
Del: bad code -- https://master.php.net/note/delete/95979/bad+code
Del: spam -- https://master.php.net/note/delete/95979/spam
Del: non-english -- https://master.php.net/note/delete/95979/non-english
Del: in docs -- https://master.php.net/note/delete/95979/in+docs
Del: other reasons-- https://master.php.net/note/delete/95979
Reject -- https://master.php.net/note/reject/95979
Search -- https://master.php.net/manage/user-notes.php