Reply to Re: [PHP] regular expression for integer range

Your name:

Reply:


Posted by Philip Hallstrom on 09/06/05 21:17

On Tue, 6 Sep 2005, babu wrote:

> Hi all,
>
>
> I want to write regular expression for checking the string format entered by user.
>
> the allowed formats are
>
> examples:
> 10
> 10,
> 10,12-10
> 12-10
>
> that is the valid strings are:
> 1. only integer
> 2. an integer, range of integers example 3
>
> and no other characters must be allowed.

ereg("^[-0-9,]+$"...

would do it, but it would also allow "10,-" as a valid expression as
well.. so if you want to check for valid ranges you'll want to beef that
up a bit...

-philip

[Back to original 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

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