how can validate special characters in textbox c#.net

Jan 17 2014 10:33 AM

hi ,

I am writing this code to validate special characters

Regex r = newRegex(@"[~`!@#$%^&*()-+=|\{}':;.,<>/?]");

      if (r.IsMatch(txtJobPackName.Text))

                {                

 MessageBox.Show("special characters are not allowed !!!");

                   TextBox1.Text ="";

                }

but my problem is that i am not able to validate some charater( []-_ " ). can you please give the sulotation. its urgent.

 


 


Answers (5)