运行下面的函数需要using System.Text.RegularExpressions命名空间的支持。
public bool checkString(string source)
{
Regex regExp=new Regex("[~!@#$%^&*()=+[\\]{}''\";:/?.,><`|!·¥…—()\\-、;:。,》《]");
return !regExp.IsMatch(source);
}
运行下面的函数需要using System.Text.RegularExpressions命名空间的支持。
public bool checkString(string source)
{
Regex regExp=new Regex("[~!@#$%^&*()=+[\\]{}''\";:/?.,><`|!·¥…—()\\-、;:。,》《]");
return !regExp.IsMatch(source);
}
转载于:https://www.cnblogs.com/yitian/archive/2008/09/16/1291407.html