On Tuesday 17 December 2002 02:46, Gerard Samuel wrote: > What Im trying to do is, reject all email address strings ending in > yahoo.com, except [EMAIL PROTECTED] > Im trying -> > <?php > > if (preg_match('/[^[EMAIL PROTECTED]|yahoo.com]$/', '[EMAIL PROTECTED]')) > { > echo 'match found'; > } > else > { > echo 'match not found'; > } > > ?> > > The search pattern must also be capable of expanding to something like -> > ^[EMAIL PROTECTED]|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 [EMAIL PROTECTED] or [EMAIL PROTECTED]
I'm not going to try writing the regex for you, but I can point out at least two problems with it: 1) ^ inside square brackets means logical NOT 2) A period (.) means "any character". If you want to match a literal period you need to escape it using a backslash. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* There's something the technicians need to learn from the artists. If it isn't aesthetically pleasing, it's probably wrong. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php