前端菜鸟

常用正则验证

 


//验证0-99两位小数点的数字

rg100 = /^((\d{1,2}(\.\d{1,2})?))$/

 stringNumber = /^[0-9]*$/

 normalNumber = /^\d+(\.\d+)?$/

 account = /^[a-zA-Z0-9_-]{4,}$/

 cellPhone = /^1[3456789]\d{9}$/

 complexPassword = /^.*(?=.{6,})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*? ]).*$/

 simplePassword = /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)]|[\(\)])+$)([^(0-9a-zA-Z)]|[\(\)]|[a-z]|[A-Z]|[0-9]){6,}$/

 qq = /^[a-zA-Z0-9_-]{4,16}$/

 dictTypeCode = /^[0-9a-zA-Z_]{1,10}$/

 dictOther = /^[\s\S]{1,30}$/

 dictNum = /^[0-9]{1,3}$/

 paramsOther = /^[\s\S]{1,50}$/

 vehicleNumber = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4,5}[A-Z0-9挂学警港澳]{1}$/

 telPhone = /^((0\d{2,3})-?)(\d{7,8})(-(\d{3,}))?$/

 positiveInteger = /^[1-9]{1,}[\d]*$/

 price = /^(0|([1-9][0-9]*))(\.\d{1,2})?$/

 email = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/

 percent = /^((\d{1,2}(\.\d{1,2})?)|100)$/

 bigPrice = /^([1-9][0-9]*)(\.\d{1,2})?$/

 postCode = /^\d{6}$/

//  IdNo = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/
 IdNo = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/

 orgCode = /^[a-zA-Z0-9]{8}-[a-zA-Z0-9]$/

 bankCard = /^([1-9]{1})(\d{14}|\d{15}|\d{18})$/

 zhengzhengshu = /^(?:(?!0)\d{1,6}|10{6})$/

//特殊字符
 regEn = /^[`!@#$%^&*()+<>?:"{},\/;'[\]]*$/

 regCn = /^[·!#¥(——):;“”‘、,|《。》?、【】[\]]*$/

 regSpec = /[`!@#$%^&*()\+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\+={}|《》?:“”【】、;‘’,。、]/im

 

(0)

本文由 Calamus 作者:calamus 发表,转载请注明来源!

热评文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注