vue、js正则表达式
let str = '验证字符串'
// 验证邮箱
str.match(/^[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/)
// 验证URL
str.match(/^https?:\/\/.+/)
// 验证qq号
str.match(/^[1-9]\d{3,14}$/)
// 验证域名
str.match(/^[\w\-.]*[\w\-]+\.[\w]+$/)
// 验证手机号
str.match(/^1[23456789]\d{9}$/)
// 验证integer
str.match(/^-?\d+$/)
// 验证银行卡号
str.replace(/\s/g, '').match(/^[1-9]\d{13,19}$/)
// 对公账户
str.match(/^\d[\d\-]{6,40}\d$/)
// 验证密码
str.match(/^(\d+|[a-zA-Z]+)$/)
博客主要围绕Vue和JavaScript中的正则表达式展开,介绍了这两种技术里正则表达式的相关内容。
1393

被折叠的 条评论
为什么被折叠?



