note 73874 added to function.eregi
| From: | rcsoft at gmail dot com | Date: | Wed, 14 Mar 2007 02:14:43 +0000 |
| Subject: | note 73874 added to function.eregi | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124430@lists.php.net to get a copy of this message | ||
Hi everybody, I tried some email validation and this is what i came up with.
<?php
//Assuming emails should have any of these combinations
//$str = "aa@a.com";
//$str = "a1@a.com";
//$str = "a.1@a.com";
//$str = "a.1a1@a.com";
//$str = "a1.a1@a.com";
//$str = "a1.a_1@a.com";
//$str = "a1.a-1@a.com";
//$str = "a1.a_1-a@a.com";
//$str = "a1.a_1-a@a-a.com";
$str = "a1.a_1-a@a-a.com.do";
//Anything out of these examples echos wrong
$str = "a1a@a.com";
if(eregi("^[a-z]+[a-z0-9_-]*(([.]{1})|([a-z0-9_-]*))[a-z0-9_-]+
[@]{1}[a-z0-9_-]+[.](([a-z]{2,3})|([a-z]{3}[.]{1}[a-z]{2}))$",$str)) {
echo "Right<br>";
} else {
echo "Wrong<br>";
};
?>
----
Server IP: 69.147.83.197
Probable Submitter: 200.88.69.126
----
Manual Page -- http://www.php.net/manual/en/function.eregi.php
Edit -- https://master.php.net/note/edit/73874
Del: integrated -- https://master.php.net/note/delete/73874/integrated
Del: useless -- https://master.php.net/note/delete/73874/useless
Del: bad code -- https://master.php.net/note/delete/73874/bad+code
Del: spam -- https://master.php.net/note/delete/73874/spam
Del: non-english -- https://master.php.net/note/delete/73874/non-english
Del: in docs -- https://master.php.net/note/delete/73874/in+docs
Del: other reasons-- https://master.php.net/note/delete/73874
Reject -- https://master.php.net/note/reject/73874
Search -- https://master.php.net/manage/user-notes.php