Esempio n. 1
0
 /// <summary>
 /// 是否是域名
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static bool IsDomain(string s)
 {
     return(IsPlumpString(s) && RegexHelper.IsMatch(s, @"^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$"));
 }
Esempio n. 2
0
 /// <summary>
 /// 是否是中文
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static bool IsChinese(string s)
 {
     return(IsPlumpString(s) && RegexHelper.IsMatch(s, @"^[\u4e00-\u9fa5]{0,}$"));
 }
Esempio n. 3
0
 /// <summary>
 /// 是手机号
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static bool IsMobilePhone(string s)
 {
     return(IsPlumpString(s) && RegexHelper.IsMatch(s, @"^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$"));
 }
Esempio n. 4
0
 /// <summary>
 /// 是否为固话号
 /// </summary>
 public static bool IsPhone(string s)
 {
     return(IsPlumpString(s) && RegexHelper.IsMatch(s, @"^(\d{3,4}-?)?\d{7,8}$"));
 }
Esempio n. 5
0
 /// <summary>
 /// 判断是否是邮件地址,来自nop的方法
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static bool IsEmail(string s)
 {
     return(IsPlumpString(s) && RegexHelper.IsMatch(s, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"));
 }
Esempio n. 6
0
 /// <summary>
 /// 判断是不是url
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static bool IsURL(string s)
 {
     return(IsPlumpString(s) && RegexHelper.IsMatch(s, @"[a-zA-z]+://[^s]*"));
 }
Esempio n. 7
0
 /// <summary>
 /// 数字或者字母
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static bool IsNUMBER_OR_CHAR(string s)
 {
     return(IsPlumpString(s) && RegexHelper.IsMatch(s, @"^[A-Za-z0-9]{4,40}$"));
 }
Esempio n. 8
0
 /// <summary>
 /// 是否是数字
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static bool IsNumber(string s)
 {
     return(IsPlumpString(s) && RegexHelper.IsMatch(s, @"^[0-9]*$"));
 }
Esempio n. 9
0
 /// <summary>
 /// 是否是时间
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static bool IsTime(string s)
 {
     return(IsPlumpString(s) && RegexHelper.IsMatch(s, @"^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$"));
 }
Esempio n. 10
0
 public static bool IsIPv6(string s) =>
 IsPlumpString(s) && RegexHelper.IsMatch(s, @"/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i");
Esempio n. 11
0
 public static bool IsIPv4(string s) =>
 IsPlumpString(s) && RegexHelper.IsMatch(s, @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$");
Esempio n. 12
0
 /// <summary>
 /// 是否是IP
 /// </summary>
 public static bool IsIP(string s) =>
 IsPlumpString(s) && RegexHelper.IsMatch(s, @"\d+\.\d+\.\d+\.\d+");
Esempio n. 13
0
 /// <summary>
 /// 是否是身份证号
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static bool IsIDCardNo(string s)
 {
     return(IsPlumpString(s) && RegexHelper.IsMatch(s, @"^(^\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$"));
 }