rules: {
digits: [
/^\d+$/, "请输入整数数字"
]
,doubles:[
/^[0-9]*[.]{0,1}[0-9]*$/,"请输入数字"
]
,positiveinteger:[
/^[1-9][0-9]*$/,"请输入正整数"
]
,letters: [
/^[a-z]+$/i, "{0}只能输入字母"
]
,tel: [
/^(?:(?:1[3-9]\d{9})|(?:0\d{2,3}[- ]?[1-9]\d{6,7})|(?:[48]00[- ]?[1-9]\d{6}))$/, "联系电话格式不正确"
]
,mobile: [
/^1[3-9]\d{9}$/, "手机号格式不正确"
]
,email: [
/^(?:[a-z0-9]+[_\-+.]?)*[a-z0-9]+@(?:([a-z0-9]+-?)*[a-z0-9]+\.)+([a-z]{2,})+$/i, "邮箱格式不正确"
]
,qq: [
/^[1-9]\d{4,}$/, "QQ号格式不正确"
]
,date: [
/^\d{4}-\d{1,2}-\d{1,2}$/, "请输入正确的日期,例:yyyy-mm-dd"
]
,time: [
/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请输入正确的时间,例:14:30或14:30:00"
]
,ID_card: [
/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[A-Z]|\d{3}[a-z])$/, "请输入正确的身份证号码"
]
,url: [
/^(https?|ftp):\/\/[^\s]+$/i, "网址格式不正确"
]
,postcode: [
/^[1-9]\d{5}$/, "邮政编码格式不正确"
]
,chinese: [
/^[\u0391-\uFFE5]+$/, "请输入中文"
]
,contentsixty: [
/^.[1-60]+$/, "不于大于60个字"
]
,username: [
/^\w{3,12}$/, "请输入3-12位数字、字母、下划线"
]
,password: [
/^[0-9a-zA-Z]{6,16}$/, "密码由6-16位数字、字母组成"
]
,accept:
function
(element, params){
if
(!params)
return
true
;
var
ext = params[0
];
return
(ext === '*') ||
(
new
RegExp(".(?:" + (ext || "png|jpg|jpeg|gif") + ")$", "i")).test(element.value) ||
this
.renderMsg("只接受{1}后缀", ext.replace('|', ','
));
}
}
});