RE: [PHP] validating an e-mail address entry

From: Date: Fri, 16 Feb 2001 15:56:42 +0000
Subject: RE: [PHP] validating an e-mail address entry
Groups: php.general 
Request: Send a blank email to php-general+get-40160@lists.php.net to get a copy of this message
Sorry about that last E-mail! Here is what I meant: if (preg_match ("/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/", $emailaddress) || preg_match ("/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/",$emailaddr ess)) { print "That is a valid e-mail.<BR>\n"; } else { print "Not a valid e-mail.<BR>\n"; } The PHP archive can be found at: http://marc.theaimsgroup.com/?l=php-general&r=1&w=2 Josh Hoover KnowledgeStorm, Inc. Searching for a new IT solution for your company? Need to improve your product marketing? Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can simplify the process for you. KnowledgeStorm - Your IT Search Starts Here > Does anyone know of a way to validate an e-mail address that > was entered > and submitted from a form? I would like to trap invalid syntax. > Perhaps there exists a script that does just that? > > I assume valid syntax is the following: > > One or more characters before the @ sign, followed by an optional '[', > then any number of letters, numbers, dashes or periods > (valid domain/IP > characters) ending in a period and then 2 or 3 letters (for domain > suffixes) or 1 to 3 numbers (for IP addresses). An ending bracket is > also allowed as it is valid syntax to have an email address like: > user@[255.255.255.0]. > > Thanks, > Don

« previous php.general (#40160) next »