Re: Warning: ereg() [function.ereg]: REG_ERANGE in ...
Re: Warning: ereg() [function.ereg]: REG_ERANGE in ...
am 19.12.2007 23:14:51 von AnrDaemon
Greetings, Rik Wasmus.
In reply to Your message dated Friday, December 14, 2007, 19:26:27,
>> I have written a function using ereg().
>>
>> function ValidateOpinion()
>> {
>> $reEmail = '^[A-Za-z0-9-.]{1,40}@[A-Za-z0-9-.]{1,70}$';
> Perhaps:
> $reEmail = '^[A-Za-z0-9.-]{1,40}@[A-Za-z0-9.-]{1,70}$';
> .. allthough this would tell you lot's of valid emailaddresses are
> invalid...
> The ereg* functions should not be used anymore, use the preg_* functions
> if you can. And it's a bogus email-validator anyway. Check Friedl's
> example of a real regex emailaddress validator, and then quickly forget
> trying to validate the whole thing (you might want to test for an MX
> record of the domain though).
Speaking on e-mail validation (and hostname validation as more common problem)
I've found an interesting trick to define a hostname as Perl RE.
Excluding the part with protocol and port definition and access
credentials, it looks like:
^[0-9a-z]+(?:[\.\-][0-9a-z]+)*$
--
Sincerely Yours, AnrDaemon
Re: Warning: ereg() [function.ereg]: REG_ERANGE in ...
am 20.12.2007 00:47:30 von luiheidsgoeroe
On Wed, 19 Dec 2007 23:14:51 +0100, AnrDaemon
wrote:
> Greetings, Rik Wasmus.
> In reply to Your message dated Friday, December 14, 2007, 19:26:27,
>
>>> I have written a function using ereg().
>>>
>>> function ValidateOpinion()
>>> {
>>> $reEmail = '^[A-Za-z0-9-.]{1,40}@[A-Za-z0-9-.]{1,70}$';
>
>> Perhaps:
>> $reEmail = '^[A-Za-z0-9.-]{1,40}@[A-Za-z0-9.-]{1,70}$';
>> .. allthough this would tell you lot's of valid emailaddresses are
>> invalid...
>
>> The ereg* functions should not be used anymore, use the preg_* functions
>> if you can. And it's a bogus email-validator anyway. Check Friedl's
>> example of a real regex emailaddress validator, and then quickly forget
>> trying to validate the whole thing (you might want to test for an MX
>> record of the domain though).
>
> Speaking on e-mail validation (and hostname validation as more common
> problem)
> I've found an interesting trick to define a hostname as Perl RE.
>
> Excluding the part with protocol and port definition and access
> credentials, it looks like:
>
> ^[0-9a-z]+(?:[\.\-][0-9a-z]+)*$
No, it doesn't, the good people at http://å京大å¦.cn/ would highly
disagree with you....
--
Rik Wasmus
Re: Warning: ereg() [function.ereg]: REG_ERANGE in ...
am 21.12.2007 06:57:20 von AnrDaemon
Greetings, Rik Wasmus.
In reply to Your message dated Thursday, December 20, 2007, 02:47:30,
>> Speaking on e-mail validation (and hostname validation as more common
>> problem)
>> I've found an interesting trick to define a hostname as Perl RE.
>>
>> Excluding the part with protocol and port definition and access
>> credentials, it looks like:
>>
>> ^[0-9a-z]+(?:[\.\-][0-9a-z]+)*$
> No, it doesn't, the good people at http://????.cn/ would highly
> disagree with you....
Can't see what You mean under Your question marks :P
Well, excluding jokes... Can You please explain Your disagreement a bit
better?
--
Sincerely Yours, AnrDaemon