Reputation: 9720
I want to create RegularExpressionValidator for validation TextBox format hh.mm.
This expression works:
^([0-9]|0[0-9]|1[0-9]|2[0-3]).[0-5][0-9]$
But if I insert 5454
in the TextBox it also passes, but it shouldn't.
Upvotes: 0
Views: 1941
Reputation: 1072
you forgot to escape .
try
^([0-9]|0[0-9]|1[0-9]|2[0-3])\.[0-5][0-9]$
Upvotes: 3
Reputation: 44259
.
is a meta character in regular expressions that matches any character. If you want to match literally just a period, then you need to escape it:
^([0-9]|0[0-9]|1[0-9]|2[0-3])\.[0-5][0-9]$
Upvotes: 5