Hello there, I'm not an expert of regexp and I need an help.
I've got a js script which accept personal regexp to check form values.
In a field I'd allow float numers as 00.00 On the net I found this: __floatNum = "/^((\d+(\.\d*)?)|((\d*\.)?\d+))$/"; which doesn't get the value mentioned above.
Any helps are welcome. Thanks in advance
trying to decode a woman mind....
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
6
posted
0
If it has to be XX.XX ^\d{2}\.\d{2}$
Eric
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
Don't forget to re-escape backslashes if you put the RE in the regexp object directly.
Or if you want nn.nn exactly, like Eric said, then do:
[ October 19, 2006: Message edited by: Bauke Scholtz ]
thanks for your help. I partially solved the problem. The field is actually destinated for quantity values starting from 0.00, so should allow numbers such as: 1 2.1 0.1 216.09 12765.00 etc.
Your code actually works fine but accept only values like 20.00
(I know, my mistake. I didn't express myself correctly).
[ October 19, 2006: Message edited by: Alessandro Ilardo ] [ October 19, 2006: Message edited by: Alessandro Ilardo ]