RE: [PHP] Why would this eregi() function not work?
| From: | Dave G | Date: | Fri, 14 Nov 2003 07:32:35 +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-169619@lists.php.net to get a copy of this message | ||
> ... escaping isn't necessary.
Thanks so much for all the helpful advice!
Okay, included the + character, and removed the escaping. And I know I'm
supposed to checking into preg_match, but I'm looking at this as an
opportunity to learn about regular expressions, so I still have a
question. I'm confused why hyphens wouldn't still need escaping. Hyphens
are used to express a range of characters. If there's a hyphen there,
won't PHP think I'm looking for a range from nothing to nothing? Or is
it clever enough to figure out what's going on?
(!eregi('^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9.-]+$', $email)
--
Cheers!
Dave G
ml@autotelic.com