[Javascript] Regular Exp

Laurent Muchacho LaurentM at london.virgin.net
Fri Jan 7 04:34:47 CST 2005


Hi Guru's

I got a regex I need but can't find any good references on regex since
netscape brought down devedge.

What I need is a regex that match any number with 2 decimal 100.00 or 43.54
I call a function on the event onKeyDown on my input type text and check if
you input a number.
I got the logic working fine but my regex only match number and I need a
number with 2 decimal. 

this is what I got for matching only number.
var number_re = /[^0-9]/g

I tried this to match any number and a dot but it doesn't work.
var number_re = /[^0-9]+\./g

I hope you guy's can give me a hand on this and with shawn relaunching this
list a few days ago I'm desperate about this regex skills he was talking
about.

Thanks 



More information about the Javascript mailing list