I want to prevent the entry of two characters together but I want the user to be able to enter one or the other as well as use the enter key. I would like to use a white list instead of black listing characters. The regular expression also needs to support a min and max length. I'm doing client side validation using the asp:regularexpression control. I do not want to have to do server side validation unless that's the only solution to this problem. Has anyone else run into this? Thanks in advance for any help.
Here is the regex I'm currently using:
(?!.(&#))^[a-zA-Z0-9!@#$%^&_=+~''"";:, \r\n.()\?-]{1,1000}$
I'm using a asp.net textbox that is set to multiline so I have to allow for \r and \n or what's the point of using a multiline textbox :)
I want to keep the user from entering &# together but allow them to enter text with & or # in it and allow all of the characters a-zA-Z0-9!@#$%^&*_=+~''"";:, \r\n.()\?-.
A valid text entry would be as follows:
I have a question about my order. The order number is 12345. Can you help me?
An invalid text entry would be as follows:
I am trying to keep the user from entering &# in the textbox, but I want to allow them to enter & or #.