//验证电话号码<br>public bool IsTelephone(string str_telephone)
{
return System.Text.RegularExpressions.
Regex.IsMatch(str_telephone, @"^(\d{3,4}-)?\d{6,8}$");
}
//验证密码
public bool IsPassword(string str_password)
{
return System.Text.RegularExpressions.
Regex.IsMatch(str_password, @"[A-Za-z]+[0-9]");
}
//验证邮政编码
public bool IsPostalcode(string str_postalcode)
{
return System.Text.RegularExpressions.
Regex.IsMatch(str_postalcode, @"^\d{6}$");
}
//验证手机号码
public bool IsHandset(string str_handset)
{
return System.Text.RegularExpressions.Regex.
IsMatch(str_handset, @"^[1][3-5]\d{9}$");
}
//验证身份证
public bool IsIDcard(string str_idcard)
{
return System.Text.RegularExpressions.Regex.
IsMatch(str_idcard, @"(^\d{18}$)|(^\d{15}$)");
}
//验证小数格式
public bool IsDecimal(string str_decimal)
{
return System.Text.RegularExpressions.Regex.
IsMatch(str_decimal, @"^[0-9]+\.[0-9]{2}$");
}
//验证月份
public bool IsMonth(string str_Month)
{
return System.Text.RegularExpressions.Regex.
IsMatch(str_Month, @"^(0?[[1-9]|1[0-2])$");
}
//验证天数
public bool IsDay(string str_day)
{
return System.Text.RegularExpressions.Regex.
IsMatch(str_day, @"^((0?[1-9])|((1|2)[0-9])|30|31)$");
}
//验证是否为数字
public bool IsNumber(string str_number)
{
return System.Text.RegularExpressions.Regex.
IsMatch(str_number, @"^[0-9]*$");
}
//验证密码长度
public bool IsPasswLength(string str_Length)
{
return System.Text.RegularExpressions.Regex.
IsMatch(str_Length, @"^\d{6,18}$");
}
//验证正整数
public bool IsIntNumber(string str_intNumber)
{
return System.Text.RegularExpressions.Regex.
IsMatch(str_intNumber, @"^\+?[1-9][0-9]*$");
}
//验证大小写
public bool IsUpChar(string str_UpChar)
{
return System.Text.RegularExpressions.Regex.
IsMatch(str_UpChar, @"^[A-Z]+$");
}
public bool IsLowerChar(string str_UpChar)
{
return System.Text.RegularExpressions.Regex.
IsMatch(str_UpChar, @"^[a-z]+$");
}
//验证是否为字母
public bool IsLetter(string str_Letter)
{
return System.Text.RegularExpressions.Regex.
IsMatch(str_Letter, @"^[A-Za-z]+$");
}
//验证是否为中文
public bool IsChinese(string str_chinese)
{
return System.Text.RegularExpressions.Regex.
IsMatch(str_chinese, @"^[\u4e00-\u9fa5]{1,}$");
}
//验证邮箱
public bool IsEmail(string str_Email)
{
return System.Text.RegularExpressions.Regex.IsMatch(str_Email,
@"^(([\w\.]+)@(([[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))|((\w+\.?)+)@([a-zA-Z]{2,4}|[0-9]{1,3})(\.[a-zA-Z]{2,4}))$");
}
//验证IP
public bool IPCheck(string IP)
{
string num = @"(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)";
return Regex.IsMatch(IP,
("^" + num + "\\." + num + "\\." + num + "\\." + num + "$"));
}
//验证Url
public bool IsUrl(string str_url)
{
return System.Text.RegularExpressions.Regex.IsMatch(str_url,
@"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?");
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有