Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hi,


I want to validate a decimal number with some condition

1. After decimal point , there is only one digit

2. After decimal point ,that one digit will be 5 . eg:- 1.5, 2.5, 33.5 ....like that..


I tried to find out , but only I found the 1st point (
/^[0-9]*(?:\.\d{1})?$/;
)..

Is there is any way to solve .it will be help full.
Posted

Try this, decimal number with only a "5" after decimal point.
^\d*.5$
 
Share this answer
 
Comments
aravindnass 29-Oct-14 13:55pm    
thanks...:)
try
C#
^(?:\d+\.)*5+$
 
Share this answer
 
Comments
aravindnass 29-Oct-14 13:55pm    
thanks for helping....
aravindnass 31-Oct-14 1:05am    
hey ...
I also want add 0 after decimal point ....
kedar001 31-Oct-14 1:49am    
only 50 or 05 also?
aravindnass 31-Oct-14 1:53am    
No I want like that - 1.0,1.5,23.0,23.5....
I found ans ...

/^\d*.[5,0]$/


Thankss...
kedar001 31-Oct-14 1:55am    
Good .. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900