赞
踩
表单开发的时候,通常会进行格式校验,下面是"邮箱格式"校验的正则表达式及用法:
- const reg=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
-
- const email='2342343234@qq.com'
-
- if(reg.test(email)){
- console.log('邮箱格式正确')
- }else{
- console.log('邮箱格式不正确')
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。