note 87838 deleted from function.preg-match by danbrown

From: Date: Wed, 03 Aug 2011 13:11:24 +0000
Subject: note 87838 deleted from function.preg-match by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182148@lists.php.net to get a copy of this message
Note Submitter: shamun dot toha at gmail dot com ---- The above patterns are tested but for this type of emails those get fails. This is most valid pattern. <?php /** * Most corrected pattern for Email validation. * */ // Valid email echo preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))* \@([a-z0-9])*(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*$/i' ,'09_az..AZ@host.dOMain.cOM'); // Invalid emails echo preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))* \@([a-z0-9])*(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*$/i' ,'09_azAZ@ho...st...........domain.com'); echo preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))* \@([a-z0-9])*(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*$/i' ,'09_azAZ@host.do@main.com'); ?> ---------------------------- Output: ---------------------------- 1 = valid 0 = invalid 0 = invalid

« previous php.notes (#182148) next »