• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regular Expression to validate a double value

 
HungryJavaGoat
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34693
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Alan Moore
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't you just use a JFormattedTextField?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic