[Javascript] RegExp

Dan Costea costea.dan at ssi-schaefer.ro
Thu Jul 24 09:34:49 CDT 2003


 /^\d{1,3}$/ doesn't match 251,9 but I added (\,\d*)?), resulting: var oReg
= /^(\d{1,3}(\,\d*)?)$/ and now it works OK!


Thank you!


----- Original Message ----- 
From: "Hassan Schroeder" <hassan at webtuitive.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Thursday, July 24, 2003 5:28 PM
Subject: Re: [Javascript] RegExp


> Dan Costea wrote:
>
> > I have the regular expresion that is matching a positiv float number:
> >
> > var oReg = /^((\d+(\,\d*)?)|((\d*\,)?\d+))$/;
> >
> > How should I modify it to match a positiv float between 0 and 999? (for
> > example, to match: 125 or 251,9 or 5).
>
> var oReg = /^\d{1,3}$/;
>
> HTH -- though it feels wrong to be using a regexp on a number :-)
> -- 
> Hassan Schroeder ----------------------------- hassan at webtuitive.com
> Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
>
>                            dream.  code.
>
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list