You are here: Re: Regular expression « PHP Programming Language « IT news, forums, messages
Re: Regular expression

Posted by davranfor on 10/17/07 20:36

On 17 oct, 20:20, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Wed, 17 Oct 2007 21:59:49 +0200, <davran...@gmail.com> wrote:
> > Hello
>
> > I need a regular expression that validate a list of numbers separated
> > by "-" , numbers can not be greater than 999
>
> > Valid examples
> > 0
> > 12-455-01
> > 1-9
> > 125-32-155-45-45
>
> > Invalid examples
> > -1
> > 45-
> > 1-45665456-4
> > 12-45-
> > -
>
> Hmmz, showing a 'best try' would be appreciated. However, I normally can't
> resist a good regex, so here it goes:
>
> '/^([1-9][0-9]?)?[0-9](-([1-9][0-9]?)?[0-9])*$/'
>
> Untested BTW. I've made 78-034-89 invalid, as a number should not start
> with zero, unless it's only 1 zero. 't Would be simpler if it was valid,
> your choice.
> --
> Rik Wasmus

thanks ;)))

 

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

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