aspose file tools*
The moose likes Java in General and the fly likes Regular Expression to validate a double value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Regular Expression to validate a double value" Watch "Regular Expression to validate a double value" New topic
Author

Regular Expression to validate a double value

HungryJavaGoat
Greenhorn

Joined: Jun 30, 2006
Posts: 23
Hi,
How can we validate a double value with regular expression in java?
For example ..if a field takes ###.### as mask ..
then user can enter atmost 3 digits before the decimal and one decimal point followed by atmost 3 digits.
thanks for the guidance in advance..
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31057
    
232

Karthik,
Take a look at the "range" symbol for Regular Expressions. This lets you say "at least one, but not more than three digits." For more help, try posting what you have so far and we can give comments.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Alan Moore
Ranch Hand

Joined: May 06, 2004
Posts: 262
Can't you just use a JFormattedTextField?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regular Expression to validate a double value