Can u all please help me out to get the regex for the range 900 to 864000 thank you
Asked
Active
Viewed 268 times
0
-
6Regex is _overkill_ here. Use Comparison `if (num >= 900 && num <= 86400)` – Tushar Nov 18 '15 at 04:23
-
hey tushar thanks for reply , but the java code i use is generic code which works for different numeric ranges,which accepts regex for the range validation , among those 900 to 864000 is one of the range – Suneil Narasimhamurthy Nov 18 '15 at 04:38
1 Answers
1
This platform is for helping with your regex, not writing your code. You probably need to split this problem into several subsections and combine them with |
pipes in an anchored group.
900
-999
to match9
followed by two digits:9\d\d
1000
-99999
any four or five digits:\d{4,5}
100000
-799999
1-7
followed by any 5 digits:[1-7]\d{5}
800000
-859999
eight followed by zero to five and any 4 digits:8[0-5]\d{4}
860000
-863999
eight followed by six followed by zero to 3 and any 3 digits:
Get coffee or better tea an try yourself!864000
An inital lookahead (?!0)
to disallow leading zeroes if desired .

bobble bubble
- 16,888
- 3
- 27
- 46