几个常用的正则判断
public static bool IsNumeric(string value) { return Regex.IsMatch(value, @"^[+-]?\d*[.]?\d*$"); } public static bool IsInt(string value) { return Regex.IsMatch(value, @"^[+-]?\d*$"); } public static bool IsUnsign(string value) { return Regex.IsMatch(value, @"^\d*[.]?\d*$"); } public static bool isTel(string strInput) { return Regex.IsMatch(strInput, @"\d{3}-\d{8}|\d{4}-\d{7}"); }
浙公网安备 33010602011771号