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
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"); }
0 comments:
Post a Comment