正則匹配只能是數(shù)字字母,開(kāi)始和結(jié)束到底匹配到哪里。let reg2=/^[a-zA-Z0-9]+$/ let reg1=/[a-zA-Z0-9]+/;//匹配至少含有一個(gè)數(shù)字或字母的字符串
let reg2=/^[a-zA-Z0-9]+$/;//?這個(gè)開(kāi)始和結(jié)尾到底匹配到哪里
console.log(reg1.test(''));//false
console.log(reg1.test('a-'));//true
console.log(reg1.test('13232-3213'));//true
console.log(reg1.test('423432432'));//true
console.log(reg2.test(''));//false
console.log(reg2.test('a-'));//false
console.log(reg2.test('13232-3213'));//false
console.log(reg2.test('423432432'));//true
正則匹配只能是數(shù)字字母,開(kāi)始和結(jié)束到底匹配到哪里?
慕姐4208626
2018-09-24 16:15:59