手机号:
let patternTel = /^1[3456789]\d{9}$/;
patternMob.exec(value)
或:
phoneReg = /^1(3|4|5|7|8|9)\d{9}$/;
邮箱:
let patternEmail = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
patternEmail.exec(value)
ip地址,多个地址使用于鉴权使用半角逗号’,'分割:
let iplist =/^((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))|\*)((\/([012]\d|3[012]|\d))?)(,((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))|\*)((\/([012]\d|3[012]|\d))?))*$/;
iplist.exec(value)
不许输入空格:
var reg = /\s+/g;
reg.test(value)
6-32位数字或字母的组合:
let appidExam = /^[A-Za-z0-9]{6,32}$/;
appidExam.exec(value)
正整数:
let patternFlow = /^([1-9][0-9]*)$/;
patternFlow.exec(value)
数字格式:
let patternMob = /^\d+(\.\d+)?$/;
patternMob.exec(value)
两位的小数或者整数:
let patternMoney = /^(([0-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
patternMoney.exec(value)
大于等于0的整数:
let patternMax = /^[+]{0,1}(\d+)$/;
patternMax.exec(value)
2-50位字符,支持字母、数字、符号、中文:
var reg = /.{2,50}/;
reg.exec(value)
英文数字下划线,且必须以英文开头,每条最长64位,以英文逗号分隔:
let regCode = /^[a-zA-Z][\w]{0,63}(,[a-zA-Z][\w]{0,63})*$/;
regCode.exec(value)
http、ftp、https网址:
websiteReg = /^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9;=\-\.\?\,\'\/\\\+&%\$#_]*)?$/;