Subscribe For Free Updates!

We'll not spam mate! We promise.

Mar 13, 2013

Regex Decimal Validation in C# Java

Views:

To day i will show how to Validate a Decimal number through regex.
Regex is very usable expression notation which is approximately same for all Programming Languages (like Java , C#, Python,  JavaScript etc  ) and also it is Very fast as compare to if else Logic. 
I already share how to use Regex in Programming Langues C#.


So, Regular expression (regex) for Decimal Point Validation is following
^([0-9]{1,5}(\\.[0-9]{0,2})?)()*$

 and We can use this Expression in Our Code like Java.

 String abc="10.0";
if(abc.matches("^([0-9]{1,5}(\\.[0-9]{0,2})?)()*$"))
{
System.out.println("VALIID");
}
else 
{
System.out.println("INVALIID");
}

Plese Feel Free to Socializer This Post
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments:

Post a Comment

Become a Fan

visual studio learn