RE: [PHP] Why would this eregi() function not work?
| From: | Dave G | Date: | Fri, 14 Nov 2003 11:56:25 +0000 |
| Subject: | RE: [PHP] Why would this eregi() function not work? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169632@lists.php.net to get a copy of this message | ||
> The last part of your pattern needs to be changed because it
> allows for a top-level domain to contain numbers and hyphens.
> Currently, such a thing does not exist.
Okay... I can change that...
(!eregi('^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9-]+.[a-zA-Z.]+$', $email))
> Also, the 2nd part of your pattern allows for a 2nd-level domain to
> start and end with a hyphen, which is also disallowed.
Hmmm... but I don't think I want to get too strict. I mean, if I can
write the code to make sure the domain doesn't start or end with the
hyphen, but can have one in between, then cool. But I think that would
require more expression footwork than I'm capable of at this point.
> I truly wish that I could point you to a canonical reference on the
> matter, but such a thing escapes me...
> http://www.opengroup.org/onlinepubs/7908799/xbd/re.html
> ... which may be helpful.
That's a pretty hefty read, but it looks useful to have around for a
reference. Thanks!
--
Cheers!
Dave G
ml@autotelic.com