Re: Reject some?

From: Date: Mon, 16 Dec 2002 20:27:43 +0000
Subject: Re: Reject some?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-128473@lists.php.net to get a copy of this message
Gerard Samuel wrote:
What Im trying to do is, reject all email address strings ending in yahoo.com, except 08701@yahoo.com. Im trying -> <?php if (preg_match('/[^08701@yahoo.com|yahoo.com]$/', '08702@yahoo.com')) { echo 'match found'; } else { echo 'match not found'; } ?> The search pattern must also be capable of expanding to something like -> ^08701@yahoo.com|yahoo.com|^foo@hotmail|hotmail.com Basically what Im trying to perform is to reject all email address strings ending in either yahoo.com or hotmail.com, except strings ending in 08701@yahoo.com or foo@hotmail.com. Thanks for any insight you may provide...
this is pretty close <?php echo (preg_match('/(?<!08701)@yahoo\.com$/', '08702@yahoo.com') ? 'match found' : 'match not found'); echo "\n"; ?> look at the manual about assertions http://www.php.net/manual/en/pcre.pattern.syntax.php -- Sean

« previous php.general (#128473) next »