# Regular Expression to validate a double value

HungryJavaGoat

Greenhorn

Posts: 23

posted 9 years ago

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..

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..

posted 9 years ago

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.

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.

[OCA 8 book] [OCP 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]

Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2

Alan Moore

Ranch Hand

Posts: 262