[Javascript] RegExp

Hassan Schroeder hassan at webtuitive.com
Thu Jul 24 09:28:26 CDT 2003


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.





More information about the Javascript mailing list