Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can any body please tell me the regex for an unsigned decimal
[+-]18 digits + . + 4 digits
eg.
111111111111111111.2222
or
-111111111111111111.2222

18 is the maximum digit preecing decimal it may be less than that.
Posted

^[+-]?\d{1,18}\.\d{4}$ for exactly what you specified, or ^[+-]?\d{1,18}(\.\d{1,4})?$ for a little more flexibility.
 
Share this answer
 
v2
Comments
ridoy 7-Jan-13 9:14am    
+5
Zoltán Zörgő 7-Jan-13 9:27am    
Thank you
souravghosh18 7-Jan-13 11:54am    
thanks for your reply.
Hi,
try the following

^\d{1,18}$
 
Share this answer
 

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