Click here to Skip to main content
11,432,241 members (56,463 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
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 7-Jan-13 3:46am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

^[+-]?\d{1,18}\.\d{4}$ for exactly what you specified, or ^[+-]?\d{1,18}(\.\d{1,4})?$ for a little more flexibility.
  Permalink  
v2
Comments
ridoy at 7-Jan-13 9:14am
   
+5
Zoltán Zörgő at 7-Jan-13 9:27am
   
Thank you
souravghosh18 at 7-Jan-13 11:54am
   
thanks for your reply.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
try the following

^\d{1,18}$
  Permalink  

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



Advertise | Privacy | Mobile
Web04 | 2.8.150428.2 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100