标签:style blog color ar for div sp log on
public class RegularHelp { //验证Email地址 public static bool IsValidEmail(string strIn) { // Return true if strIn is in valid e-mail format. return Regex.IsMatch(strIn, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"); } //验证是否为电话号码 public static bool IsValidTel(string strIn) { return Regex.IsMatch(strIn, @"(d+-)?(d{4}-?d{7}|d{3}-?d{8}|^d{7,8})(-d+)?"); } //验证手机号 public static bool IsValidPhone(string strIn) { return Regex.IsMatch(strIn, @"^[1][345789]\d{9}$"); } //验证登录名 public static bool IsVaildLoginName(string strIn) { return Regex.IsMatch(strIn, @"^[a-zA-Z]{1}[a-zA-Z0-9_]{5,15}$"); } //验证密码 public static bool IsVaildPassword(string strIn) { return Regex.IsMatch(strIn, @"^[A-Za-z0-9!@#$%^&*~]{6,22}$"); } }
标签:style blog color ar for div sp log on
原文地址:http://www.cnblogs.com/llxy/p/3972939.html