Re: eregi and emails
| From: | Mukul Sabharwal | Date: | Mon, 23 Oct 2000 09:58:40 +0000 |
| Subject: | Re: eregi and emails | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-21759@lists.php.net to get a copy of this message | ||
(eregi("^[_\.0-9a-z-]+@([0-9a-z][-0-9a-z\.]+)\.([a-z]{2,3}$)",$email,
$check))
In the above ->
you're searching for a '\', '_', '.', '-' or an
alphanum entry, which should occur atleast one or more
times, followed by @, followed by an alphanum entry
followed by another alphanum or a slash or a dot,
followed by a '.' then by minimum 2 or 3 minimum
letters, at the end.
Now in the above the following would be valid :
\._@m\3..com -> do u want this ? not exactly!
eregi("(^[a-z0-9]+)([_.-]([a-z0-9])+)*[@]([a-z0-9]+)
([._-]([a-z0-9]+))*[.]([a-z0-9]){2}([a-z0-9])?$
try the above.... alphanum followed 0 or more dots
which necessarily (if a . is there) have to be
followed by a letter or number (eg: mukul.18), this
can be done unlimited no. of times (eg:
mukul.net.18.hello) followed by @ followed by an
alphanum then by 0 or more dots which again
necessarily have to be followed by a letter or number,
again which can go unlimited times :
@gh.ghg.gkjd.12 the only problem now here is that a
guy can enter mukul@domain.12 ... and the last part is
what defines the above that if there is a subdomainal
address then an ext. is necessary.
hope this clears it up.
Thanks to Lars Torben Wilson and Maxim Maletsky who
cleared by RegExp fundas.
thanks.
=====
To Find Out More About Me : http://mukul.tsx.org/
__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf! It's FREE.
http://im.yahoo.com/