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.

VulpesPosted Jan 17, 2014, 11:25 AM
Regex r = new Regex(@"[~`!@#$%^&*()+=|\\{}':;.,<>/?[\]""_-]");
VulpesPosted Dec 3, 2014, 10:05 AM
Naga HarshaPosted Dec 3, 2014, 9:56 AM
Naeem KhanPosted Jan 17, 2014, 11:12 AM
I m given you code for all validation like address, name , price etc..
just implement this code..
hope it would be help full for you..if not then reply me will give you other solution
VulpesPosted Jan 17, 2014, 11:08 AM
Regex r = new Regex(@"[~`!@#$%^&*()+=|\{}':;.,<>/?[\]""_-]");
Note that:
1. ']' needs to be escaped by prefixing it with '\' so that it's not treated as the end of the set.
2. It's generally best to place hyphen '-' at the end of the set so it's not treated as the range operator.
3. The double quote symbol '"' needs to be doubled as it's within a verbatim string.