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.


VulpesRank #55 · 29.2K reputationPosted Jan 17, 2014, 6:25 AM EST
Regex r = new Regex(@"[~`!@#$%^&*()+=|\\{}':;.,<>/?[\]""_-]");
VulpesRank #55 · 29.2K reputationPosted Jan 17, 2014, 6:08 AM EST
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.
Naeem KhanRank #2,072 · 698 reputationPosted Jan 17, 2014, 6:12 AM EST
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
Naga Harsha2 reputationPosted Dec 3, 2014, 4:56 AM EST
VulpesRank #55 · 29.2K reputationPosted Dec 3, 2014, 5:05 AM EST