Re: Why would this eregi() function not work?
| From: | David T-G | Date: | Fri, 14 Nov 2003 04:35:20 +0000 |
| Subject: | Re: Why would this eregi() function not work? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169618@lists.php.net to get a copy of this message | ||
Dave --
..and then Dave G said...
%
% > 2) Sure enough, you don't allow "+" extensions in yours.
% > Neener neener :-)
%
% Is + a legal character in emails?
Yep. IIRC sendmail and postfix use it for their extensions like qmail
uses (by default) a - (but qmail can use whatever you want). See 1)
again :-)
%
% > 3) You might check out preg_match, which the manual says is
% > often faster than ereg().
%
% Will look into it. Thanks for the tip.
Sure thing!
%
% > 4) To include '-' in a range list, put it last in the range.
%
% So then it would look like this:
% (!eregi('^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\.\-]+$', $email)
% Is that right?
Yes, except change all
\.\-
to
.-
since escaping isn't necessary.
%
% > 1. Special characters within brackets do not need to be escaped. [.]
% > will match a period.
%
% So then I could make it:
% (!eregi('^[a-zA-Z0-9_.\-]+@[a-zA-Z0-9\-]+.[a-zA-Z0-9.\-]+$', $email)
% Correct?
Almost there.
%
% > 3. I don't think a hyphen is even legal in an email address...
%
% If it wasn't, the user couldn't have emailed me to tell me that he
% wasn't having success in registering on my form. Or could he?
I already poked at him about that. Look at my address, for instance ;-)
%
% --
% Cheers!
% Dave G
% ml@autotelic.com
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!