Regular expression to validate the special string

 Run the following function requires using support System.Text.RegularExpressions namespace.

 
  public bool checkString(string source)
  {
   Regex regExp=new Regex("[~!@#$%^&*()=+[\\]{}''\";:/?.,><`|!·¥…—()\\-、;:。,》《]");
   return !regExp.IsMatch(source);
  }
 

 

Reproduced in: https: //www.cnblogs.com/yitian/archive/2008/09/16/1291407.html

Guess you like

Origin blog.csdn.net/weixin_33841722/article/details/93710332