PDA

View Full Version : Regular Expression


Unknown
12-06-2008, 05:20 PM
I'm trying to figure what the regular expression is to validate a user input that must be GREATER THAN or EQUAL to 5.

For RangeValidator you have to specifiy both maximum and minimum, when I only want to specifiy minimum.

SouthwaterDave
12-07-2008, 02:54 PM
It would be easier to specify a maximum, even if it is 999,999,999,999, than to use a regular expression validator. However, the following regular expression should work (for integers):
^(([5-9])|([1-9]\d{1,11}))$
^ = start of string
([5-9]) = a single digit in the range 5 to 9
|([1-9]\d{1,11}) = OR a non-zero digit followed by 1 to 11 digits
$ = end of string

So, even here, I have specified a maximum value.