正则表达式

if (Regex.IsMatch(str,"[0-9]"))//数字
  MessageBox.Show("字符串中包含有数字");
if (Regex.IsMatch(str,"[a-z]"))//小写字母
  MessageBox.Show("字符串中包含有小写字母");
if (Regex.IsMatch(str,"[A-Z]"))//大写字母
  MessageBox.Show("字符串中包含有小写字母");
if (Regex.IsMatch(str,"[a-zA-Z]"))//所有字母
  MessageBox.Show("字符串中包含有字母");
if (Regex.IsMatch(str,"[\u4e00-\u9fa5]"))//汉字
  MessageBox.Show("字符串中包含有汉字");
原文地址:https://www.cnblogs.com/moss_tan_jun/p/1991663.html