note 86525 added to function.preg-match
| From: | phil dot taylor at gmail dot com | Date: | Thu, 23 Oct 2008 00:01:20 +0000 |
| Subject: | note 86525 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145628@lists.php.net to get a copy of this message | ||
If you need to check for .com.br and .com.au and .uk and all the other crazy domain endings i found
the following expression works well if you want to validate an email address. Its quite generous in
what it will allow
<?
$email_address = "phil.taylor@a_domain.tv";
if (preg_match("/^[^@]*@[^@]*\.[^@]*$/", $email_address)) {
return "E-mail address";
}
?>
----
Server IP: 117.104.160.194
Probable Submitter: 203.206.176.162
----
Manual Page -- http://www.php.net/manual/en/function.preg-match.php
Edit -- https://master.php.net/note/edit/86525
Del: integrated -- https://master.php.net/note/delete/86525/integrated
Del: useless -- https://master.php.net/note/delete/86525/useless
Del: bad code -- https://master.php.net/note/delete/86525/bad+code
Del: spam -- https://master.php.net/note/delete/86525/spam
Del: non-english -- https://master.php.net/note/delete/86525/non-english
Del: in docs -- https://master.php.net/note/delete/86525/in+docs
Del: other reasons-- https://master.php.net/note/delete/86525
Reject -- https://master.php.net/note/reject/86525
Search -- https://master.php.net/manage/user-notes.php