note 88007 deleted from function.preg-match by danbrown

From: Date: Wed, 03 Aug 2011 13:11:18 +0000
Subject: note 88007 deleted from function.preg-match by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182147@lists.php.net to get a copy of this message
Note Submitter: Reno ---- I modified your email validation pattern to solve these issues: - the string MUST contain a TLD - TLD can be 2 letters long as well as 3 or more (ie: .ca, .us, .uk, .fr, etc.) - domain name (tld not included) must contain at least 2 characters - domain name can contain "-"if it's not the first nor the last character. <?php $pattern = '/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])' . '(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i'; echo preg_match ($pattern, "email-address-to-validate@host.tld"); ?>

« previous php.notes (#182147) next »