Skip to content

常用正则表达式

web240 edited this page Dec 12, 2016 · 2 revisions

###验证8到12位数字加字母的 var reg = /^(?!([a-zA-Z]+|\d+)$)[a-zA-Z\d]{8,12}$/;
var reg1=/^(?=.[a-zA-Z])(?=.[0-9])[a-zA-Z0-9]{8,12}$/;
console.log(reg.test('123456789'));//false
console.log(reg.test('12345678a'));//true

Clone this wiki locally