using System.Text.RegularExpressions;
Regex rex = new Regex("[a-z0-9A-Z_]+");
Match ma = rex.Match("你的字符串");
if (ma.Success)
{
MessageBox.Show("OK");
}
else
{
MessageBox.Show("Fail");
}
string str = "abcdefg123_";
foreach(char s in str)
{
if (!char.IsLetter(s))
{
//不是字母的情况
}
}