[thelist] regex help
DUCROCQ Yann FT/DSI/SICOR
yann.ducrocq at francetelecom.com
Mon Sep 20 09:54:59 CDT 2004
Hello,
I think you should divide this test in two parts :
1. is the string empty ?
2. does the string match with this regExp : /^(([0-1]?[0-9]\.[0-9])|(2[0-3]\.[0-9])|(24\.0))$/
I am sure we could find something shorter though... ;-)
Yanno
> -----Message d'origine-----
> De : thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org]De la part de
> Theodore Serbinski
> Envoyé : lundi 20 septembre 2004 16:36
> À : thelist at lists.evolt.org
> Objet : [thelist] regex help
>
>
> hey all! i'm working on form validation for numerical
> timesheet values
> but i can't seem to get the regex right to test the values.
> what i have
> right now is:
>
> /^([012]?[0-9]\.[0-9])?$/
>
> i'm trying to test for all values in this range:
>
> 0.0 - 24.0
>
> with these stipulations:
>
> - an empty string is ok, treated as 0 by the script anyways
> - only one decimal place allowed, which is optional
>
> any help is appreciated, i'm still really new at these
> regexes. thanks!
>
> ted
> --
>
> News! - Evolt.org conference for web professionals.
> 17-19 September 2004 in Toronto, Canada.
> Details at http://TOevolt.org
>
> * * Please support the community that supports you. * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
More information about the thelist
mailing list