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 AnrDaemon on 12/19/07 22:17

Greetings, Good Man.
In reply to Your message dated Friday, December 14, 2007, 22:31:29,

>> I have written a function using ereg().
>>
>> function ValidateOpinion()
>> {
>> $reEmail = '^[A-Za-z0-9-.]{1,40}@[A-Za-z0-9-.]{1,70}$';
>> if (isset($_POST['Author']) && !empty($_POST['Author']) &&
>> isset($_POST['Email']) && ereg($reEmail, $_POST['Email']) &&
>> // HERE
>> PROBLEM
>> isset($_POST['Title']) && !IsVulgar($_POST['Title']) &&
>> isset($_POST['Contents']) && !empty($_POST['Contents']))
>> return true;
>> echo '<p class="Error">Opinion was not accepted.</p>\n';
>> return false;
>> }
>>
>> I recive error:
>>
>> Warning: ereg() [function.ereg]: REG_ERANGE in
>> F:\Inetpub\wwwroot\StowarzyszenieIntegracja\Scripts.inc on line 51
>>
>> I don't know what's wrong.
>> Could you help me please? I have little experience.
>> /RAM/

> You can google to discover that you're using your '-' incorrectly:

> @[A-Za-z0-9-.]{1,70}

> If you are searching for the character '-', it needs to be mentioned
> first. Otherwise regex is going to look for a range, which is invalid
> (in your case, your range is set to "0-9-.")

Other way is to escape "-" character. It works for Perl RE, but I don't know
if the same is true for POSIX RE.
Also You SHOULD escape the dot all the way if You don't know what You doing.


--
Sincerely Yours, AnrDaemon <anrdaemon@freemail.ru>

 

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

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