Regular Expression help

From: Date: Fri, 29 Jun 2001 13:08:59 +0000
Subject: Regular Expression help
Groups: php.general 
Request: Send a blank email to php-general+get-55560@lists.php.net to get a copy of this message
Hi everyone, I have a new user function that checks e-mail addresses. I wish to only allow people from two different domains to register. How can I filter out all other e-mail addresses and return an error if it's not from those domains. Here's what I have: if ((!$email) || ($email=="") || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$",$email))) $stop = "<center>"._ERRORINVEMAIL."</center><br>"; What this currently does is just makes sure it's a valid e-mail address. What I'd like it to do is if the user enters anything except @domain1.com or @domain2.com it spits out the error (ERRORINVEMAIL) So (I think) It would look something like this: if ((!$email) || ($email=="") || (!eregi("^[_\.0-9a-z-]+@([DdOoMmAaIiNn1] || (or statement???) [DdOoMmAaIiNn2-]+\.)+[a-z]{2,3}$",$email))) $stop = "<center>"._ERRORINVEMAIL."</center><br>"; Of course, this doesn't work, but you get the point. Thanks! P.S. Thanks for the Awesome List! Clayton Dukes CCNA, CCDA, CCDP, CCNP Download Free Essays, Term Papers and Cisco Training from http://www.gdd.net

« previous php.general (#55560) next »