> > you're right, but then you should extend your validation expression
>
> Yes, I think I've compressed my original one down now:
> ([0-1][0-9]|2[0-3]):([0-5][0-9])
> Does that look right?
No.
The logic is very simple. The brackets [] denote a number range.
[0|1|2] indicates that we are looking for 0, 1, or 2
[0|1|2|3] indicates that we are looking for 0, 1, 2, or 3
so, [0|1|2][0|1|2|3] will validate 00, 01, 02 .. 23, but not 24, 25
etc.
So, to validate "[00-23]:[00-59]" you would need something like the
following string
\[[0|1|2][0|1|2|3]-[0|1|2][0|1|2|3]\]:\[[0|1|2|3|4|5][0|1|2|3|4|5|6|7|
8|9]-[0|1|2|3|4|5][0|1|2|3|4|5|6|7|8|9]\]
Hope this helps
Leon Mayne - 04 Mar 2008 08:44 GMT
>> Yes, I think I've compressed my original one down now:
>> ([0-1][0-9]|2[0-3]):([0-5][0-9])
[quoted text clipped - 12 lines]
> \[[0|1|2][0|1|2|3]-[0|1|2][0|1|2|3]\]:\[[0|1|2|3|4|5][0|1|2|3|4|5|6|7|
> 8|9]-[0|1|2|3|4|5][0|1|2|3|4|5|6|7|8|9]\]
What's the difference between [0|1|2|3|4|5|6|7|8|9] and [0-9]?
Alexey Smirnov - 04 Mar 2008 09:42 GMT
> >> Yes, I think I've compressed my original one down now:
> >> ([0-1][0-9]|2[0-3]):([0-5][0-9])
[quoted text clipped - 16 lines]
>
> - Show quoted text -
Hi Leon
Sorry I think you're right and I did a mistake in my answer. The
syntax for the regular-expression validation controls is a little bit
different than on the server and so, it's always better to validate
each expression using a validator control (I thought 0-9 will not work
there). Please refer to http://msdn2.microsoft.com/en-us/library/ae5bf541.aspx.
So, if you want to validate a regular 24hr time input string then you
expression will work.
Note, "[0-9]" equivalent to "\d"
Leon Mayne - 04 Mar 2008 11:29 GMT
> Note, "[0-9]" equivalent to "\d"
Good point, so it could be:
([0-1]\d|2[0-3]):([0-5]\d)
Jesse Houwing - 04 Mar 2008 13:22 GMT
Hello Alexey,
>> "Alexey Smirnov" <alexey.smir...@gmail.com> wrote in message
>>
[quoted text clipped - 32 lines]
> expression will work.
> Note, "[0-9]" equivalent to "\d"
As a side note:
[0123456789] equals [0-9]
but [0|1|2|3|4|5|6|7|8|9|0] equals [0-9|] you should not use the | within
a range.
Another note, the clientside and serverside validations are almost equal.
A few specifics in substracting ranges from an existing group and look behinds
are all that differentiate them. You can find the exact info on http://www.regular-expressions.info/refflavors.html
--
Jesse Houwing
jesse.houwing at sogeti.nl