111,126
社区成员
发帖
与我相关
我的任务
分享
public static bool IsNumberOREnglish(string str)
{
if (Regex.IsMatch(str, @"[0-9a-zA-Z]*${1,}", RegexOptions.IgnoreCase))
return true;
else
return false;
}
其实这样就行了:
public static bool IsNumberOREnglish(string str)
{
return Regex.IsMatch(str, @"^[0-9a-zA-Z]+$");
}if (Regex.IsMatch(str, @"^[0-9a-zA-Z]+$", RegexOptions.IgnoreCase))