You are here: Re: Warning: ereg() [function.ereg]: REG_ERANGE in ... « PHP Programming Language « IT news, forums, messages
Re: Warning: ereg() [function.ereg]: REG_ERANGE in ...

Posted by Rik Wasmus on 12/19/07 23:47

On Wed, 19 Dec 2007 23:14:51 +0100, AnrDaemon <anrdaemon@freemail.ru>
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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация