Click here to Skip to main content
14,867,838 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello All,


I want to validate my textbox and email fields not to contain
>> << < > ( ) { } [ ] ? & * ~ ` ! # $ % ^ = + | \ : ' " , ; these special characters and can contain - _ @ / . these sepcial characters.

How can i do it?

Thanks in advance,
Regards.
Posted

The simple regex is easy: @"[^\<\>...]" where the elipsis is the list of individual characters you want to prohibit.

However, I would suggest that a better email address validation would be a good idea, especially since '@' is not a legal character in an email address (it is the separator between the domain and the local addresses and cannot be used for any other reason): have a look at this[^]
   
I recommend the following freeware to regular expression things
Expresso 3.0 - The premier regular expression development tool[^]
   
Comments
   
Useful advice, my 5.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900