how about "^\d{1,3}(\.\d{1,2})?$"
Here is the testcase
import org.apache.commons.validator.GenericValidator;
public class TestFloat{
public static void main(String[] args) throws Exception {
String[] f = new String[]{"123.23", "123", "1234.23", "1234.234",
"12345.2342", "11234.123.23",
Hi Nathan,
Two suggestions:
1.) Mastering Regular Expressions by J.E.E. Friedel
(http://www.amazon.com/exec/obidos/ASIN/0596002890/qid=1105937543/sr=2-1/ref=pd_ka_b_2_1/002-6332011-0856023)
2.) Kodos (http://kodos.sourceforge.net/home.html)
Good luck,
Curtis
Nathan Coast wrote:
Hi,
I have a price
Hi,
I have a price field that I want to validate as a float with these
additional constraints 1-3 digits before the decimal, if the decimal
exists, 1-2 digits after the decimal.
anyone know the regexp that describes this?
cheers
Nathan
--
Nathan Coast
Managing Director
Codeczar Ltd
mob : (852) 9
3 matches
Mail list logo