Title |
Test
Find
Positive Integers (Data type)
|
Expression |
^(\d|\d{1,9}|1\d{1,9}|20\d{8}|213\d{7}|2146\d{6}|21473\d{5}|214747\d{4}|2147482\d{3}|21474835\d{2}|214748364[0-7])$ |
Description |
Matches any integer from 0 to 2147483647 (max Integer size for C#, Java, others) |
Matches |
0 | 352533 | 2147483647 |
Non-Matches |
-1 | 2.4 | 2147483648 |
Author |
Rating:
Alex Koller
|
Source |
|
Your Rating |
|
Title: RE: Misses values
Name: Martin
Date: 9/14/2010 12:15:41 PM
Comment:
Try this for positive int32 values (1 - 2147483647) with an (optional) unlimited number of leading 0's:
^(0+)?([1-9]\d{0,8}|21[0-4][0-7][0-4][0-8][0-3][0-6][0-4][0-7])$
Or this to include 0's (no leading 0's in this case):
^([0-9]\d{0,8}|21[0-4][0-7][0-4][0-8][0-3][0-6][0-4][0-7])$
Title: RE: Misses values
Name: Martin
Date: 9/14/2010 12:15:32 PM
Comment:
Try this for positive int32 values (1 - 2147483647) with an (optional) unlimited number of leading 0's:
^(0+)?([1-9]\d{0,8}|21[0-4][0-7][0-4][0-8][0-3][0-6][0-4][0-7])$
Or this to include 0's (no leading 0's in this case):
^([0-9]\d{0,8}|21[0-4][0-7][0-4][0-8][0-3][0-6][0-4][0-7])$
Title: Misses vales
Name: Isaac
Date: 2/13/2010 9:39:47 AM
Comment:
It misses some valid values like 2147483639