You are here: Re: Easy ereg() question « PHP Programming Language « IT news, forums, messages
Re: Easy ereg() question

Posted by Juliette on 09/18/05 01:23

news@celticbear.com wrote:
> I'm trying to make sure a form has only one or two digits in either of
> two fields.
> I looked at php.net and
> http://www.regular-expressions.info/reference.html and this is what I
> put together, but while it successfully refuses any non-digit, it still
> lets any number of digits through.
>
> Any suggestions?
>
> if ((ereg("([0-9]{1,2})", $people))&&(ereg("([0-9]{1,2})", $rooms))) {
>
> Thanks!
> Liam
>

Try: ^([0-9]{1,2})$
^ = beginning of string
$ = end of string

Grz, jrf

 

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

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