views:

32

answers:

1

I want only letters and the special symbols / and - in my textbox.

How should be the expression like to give in custom validator?

Thanks In Advance

+5  A: 

You should use a RegularExpressionValidator.

The expression should be something like ^[a-zA-Z/\-]+$

If the text cannot be empty, you need a RequiredFieldValidator aswell, as all the other validators are only called if the text is not empty.

klausbyskov
I think you mean more like this `^[a-zA-Z/\-+]*$ `.
Steven
@Steven, you are right, the regex was a bit off. I have updated it.
klausbyskov