Re: eregi and emails
| From: | Robin Vickery | Date: | Mon, 23 Oct 2000 09:57:55 +0000 |
| Subject: | Re: eregi and emails | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-21758@lists.php.net to get a copy of this message | ||
>>>>> "KB" == Kurth Bemis <kurth@usaexpress.net> writes:
> hey all look at this code..... i input kurth@usaexpress.net and
> its returns true...i input kurth@usaexpress.au or
> kurth@usaexpress.com.au
> and i get false....looking at my regexp i see nothing wrong....does
> somebody else?
> if (eregi("^[_\.0-9a-z-]+@([0-9a-z][-0-9a-z\.]+)\.([a-z]{2,3}$)",
> $email, $check)) {
This regular expression matches all the examples you gave. Is it possible
that you had spaces before or after your test strings? It might be an idea
to trim() the input before trying to match it.
Incidently your regular expression matches foo@bar...baz which it probably
shouldn't.
-robin
--
Robin Vickery...............................................
Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK
Email: robin@planet-three.net Phone: +44 (0)870 729 5444