This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30076
    
149

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
 
Similar Threads
Alphabets only valitation
validating double value using regular expression
printf question
Double Value
Validation Using Regular Expression in Javascript