Check for special characters in the passed string If special character is found returns True else False.We will use IsMatch method of RegularExpressions class. Using System.Text.RegularExpressions;
public bool CheckForSpecialChars(string Param)
{
bool Return = false;
Regex lrexRe = new Regex("[0-9!@#$%&()+-=]");
if (lrexRe.IsMatch(Param))
{
Return = true;
}
return Return;
}
bool is_special_chars1 = CheckForSpecialChars("vishal#neeraj&#$JKKKN$%&**()"); //true
bool is_special_chars2 = CheckForSpecialChars("vishalneeraj"); //false