12,996,975 members (125,482 online)
Rate this:
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 7-Jan-13 2:46am

Rate this:

## Solution 2

`^[+-]?\d{1,18}\.\d{4}\$` for exactly what you specified, or `^[+-]?\d{1,18}(\.\d{1,4})?\$` for a little more flexibility.
v2
ridoy 7-Jan-13 9:14am

+5
Zoltán Zörgő 7-Jan-13 9:27am

Thank you
souravghosh18 7-Jan-13 11:54am

Rate this:

## Solution 1

Hi,
try the following

^\d{1,18}\$

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

Top Experts
Last 24hrsThis month
 ppolymorphe 280 OriginalGriff 260 RickZeeland 225 Peter Leow 90 Karthik Bangalore 90
 OriginalGriff 4,402 ppolymorphe 2,122 Kornfeld Eliyahu Peter 1,893 RickZeeland 1,801 Richard Deeming 1,513

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 7 Jan 2013