当前位置:网站首页>常用正则表达式整理
常用正则表达式整理
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的数字,最多保留四位小数'
}
}
};
边栏推荐
猜你喜欢
![[number theory] divisor](/img/ec/036d7e76cc566c08d336444f2898e1.jpg)
[number theory] divisor

Nanny level problem setting tutorial

QT creator runs the Valgrind tool on external applications

One click extraction of tables in PDF

Install mongdb tutorial and redis tutorial under Windows
![[download app for free]ineukernel OCR image data recognition and acquisition principle and product application](/img/1b/ed39a8b9181660809a081798eb8a24.jpg)
[download app for free]ineukernel OCR image data recognition and acquisition principle and product application

Use dapr to shorten software development cycle and improve production efficiency

Error connecting to MySQL database: 2059 - authentication plugin 'caching_ sha2_ The solution of 'password'

QT creator specifies dependencies

AI benchmark V5 ranking
随机推荐
02 staff information management after the actual project
Windows下安装MongDB教程、Redis教程
L2-007 家庭房产 (25 分)
Heating data in data lake?
QT creator specifies dependencies
Codeforces Round #753 (Div. 3)
AcWing 1298. Solution to Cao Chong's pig raising problem
Punctual atom stm32f103zet6 download serial port pin
Knowledge Q & A based on Apache Jena
一键提取pdf中的表格
保姆级出题教程
[download app for free]ineukernel OCR image data recognition and acquisition principle and product application
數據庫高級學習筆記--SQL語句
QT creator test
vs2019 使用向导生成一个MFC应用程序
Basic use of redis
软件测试与质量学习笔记3--白盒测试
数据库高级学习笔记--SQL语句
When using lambda to pass parameters in a loop, the parameters are always the same value
Django运行报错:Error loading MySQLdb module解决方法