当前位置:网站首页>常用正则表达式整理
常用正则表达式整理
2022-07-06 09:15:00 【iatkotworld】
表单校验常用正则表达式整理(持续更新)
整理常用正则表达式
const verifyObj = {
money: function (value, item) {
if (value && !(/^([1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(value))) {
return '请输入正确金额,最多两位小数'
}
},
emails: function (value, item) {
if (value && !(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(value))) {
return '请输入正确邮箱'
}
},
number: function (value, item) {
if (value && !(/^\d*$/.test(value))) {
return '请输入纯数字'
}
},
bankCard: function (value, item) {
if (value && !(/^([1-9]{1})(\d{14}|\d{18})$/.test(value))) {
return '请输入正确的银行卡号'
}
},
mobilephone: function (value, item) {
if (value && !(/^1[3,4,5,6,7,8,9]\d{9}$/.test(value))) {
return '输入正确的手机号'
}
},
phone: function (value, item) {
if (value && !(/^((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/.test(value))) {
return '输入正确的联系方式'
}
},
idCard: function() {
if (value && !(v.test(value))) {
return '请输入正确的身份证号'
}
},
num1t100: function (value, item) {
if (value && !(/^\d{1,2}\.?\d{0,4}$|100/.test(value))) {
return '请输入0-100的数字,最多保留四位小数'
}
}
};
边栏推荐
猜你喜欢

Cookie setting three-day secret free login (run tutorial)

wangeditor富文本引用、表格使用问题

Software testing and quality learning notes 3 -- white box testing

打开浏览器的同时会在主页外同时打开芒果TV,抖音等网站

Learn winpwn (2) -- GS protection from scratch

Double to int precision loss

一键提取pdf中的表格
![[Blue Bridge Cup 2017 preliminary] grid division](/img/e9/e49556d0867840148a60ff4906f78e.png)
[Blue Bridge Cup 2017 preliminary] grid division

Did you forget to register or load this tag

安装numpy问题总结
随机推荐
Remember the interview algorithm of a company: find the number of times a number appears in an ordered array
ES6 let and const commands
QT creator custom build process
AcWing 179. Factorial decomposition problem solution
[download app for free]ineukernel OCR image data recognition and acquisition principle and product application
L2-007 家庭房产 (25 分)
ES6 Promise 对象
QT creator create button
QT creator test
AI benchmark V5 ranking
牛客Novice月赛40
Software I2C based on Hal Library
AcWing 1298. Solution to Cao Chong's pig raising problem
[蓝桥杯2020初赛] 平面切分
Nanny level problem setting tutorial
[BSidesCF_2020]Had_a_bad_day
Project practice - background employee information management (add, delete, modify, check, login and exit)
Software testing and quality learning notes 3 -- white box testing
解决安装Failed building wheel for pillow
Image recognition - pyteseract TesseractNotFoundError: tesseract is not installed or it‘s not in your path