laineysgl 2016-08-15
email: (/^[0-9a-z][0-9a-z\-\_\.]+@([0-9a-z][0-9a-z\-]*\.)+[a-z]{2,}$/i),//邮箱  
phone: (/^0[0-9]{2,3}[2-9][0-9]{6,7}$/),//座机手机号码  
ydphpne: (/^((13[4-9])|(15[012789])|147|182|187|188)[0-9]{8}$/),//移动手机号码  
allphpne: (/^((13[0-9])|(15[0-9])|(18[0-9]))[0-9]{8}$/),//所有手机号码  
ltphpne: (/^((13[0-2])|(15[56])|(186)|(145))[0-9]{8}$/),//联通手机号码  
dxphpne: (/^((133)|(153)|(180)|(189))[0-9]{8}$/),//电信手机号码  
url: (/^http:\/\/([0-9a-z][0-9a-z\-]*\.)+[a-z]{2,}(:\d+)?\/[0-9a-z%\-_\/\.]+/i),//网址  
num: (/[^0-9]/),//数字  
cnum: (/[^0-9a-zA-Z_.-]/),  //字符
photo: (/\.jpg$|\.jpeg$|\.gif$/i),//图片格式 
area:/^[0-9a-zA-Z]+[0-9a-zA-Z\.-]*\.[a-zA-Z]{2,4}$/   //域名校验//校验序号为0-100的整数
var type = /^([1-9]\d?|99)$/;
var re = new RegExp(type);
var a = "fdrrr";
校验的三种方式:
方式一:
if(!type.test(a)){
alert("校验不通过");
}
方式二:
if(a.match(type)==null){
alert("校验不通过");
}
方式三:
if(a.match(re)==null){
alert("校验不通过");
}