当前位置:网站首页>常用正则表达式整理
常用正则表达式整理
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的数字,最多保留四位小数'
}
}
};
边栏推荐
- Vs2019 desktop app quick start
- vs2019 使用向导生成一个MFC应用程序
- AcWing 1298.曹冲养猪 题解
- Record a problem of raspberry pie DNS resolution failure
- 机器学习笔记-Week02-卷积神经网络
- 自动机器学习框架介绍与使用(flaml、h2o)
- Double to int precision loss
- [蓝桥杯2020初赛] 平面切分
- AcWing 242. A simple integer problem (tree array + difference)
- Armv8-a programming guide MMU (2)
猜你喜欢

QT creator specifies dependencies

Rhcsa certification exam exercise (configured on the first host)

QT creator custom build process
![[free setup] asp Net online course selection system design and Implementation (source code +lunwen)](/img/ac/b518796a92d00615cd374c0c835f38.jpg)
[free setup] asp Net online course selection system design and Implementation (source code +lunwen)

安装numpy问题总结

AcWing 1298. Solution to Cao Chong's pig raising problem

Unable to call numpy in pycharm, with an error modulenotfounderror: no module named 'numpy‘

Request object and response object analysis

Nanny level problem setting tutorial
![[蓝桥杯2017初赛]方格分割](/img/e9/e49556d0867840148a60ff4906f78e.png)
[蓝桥杯2017初赛]方格分割
随机推荐
How to build a new project for keil5mdk (with super detailed drawings)
基于apache-jena的知识问答
MySQL与c语言连接(vs2019版)
Antlr4 uses keywords as identifiers
L2-007 家庭房产 (25 分)
报错解决 —— io.UnsupportedOperation: can‘t do nonzero end-relative seeks
數據庫高級學習筆記--SQL語句
QT creator support platform
引入了junit为什么还是用不了@Test注解
Solution of deleting path variable by mistake
Codeforces Round #753 (Div. 3)
MTCNN人脸检测
error C4996: ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_s instead
Software testing and quality learning notes 3 -- white box testing
一键提取pdf中的表格
QT creator runs the Valgrind tool on external applications
QT creator uses Valgrind code analysis tool
Software testing - interview question sharing
QT creator create button
{一周总结}带你走进js知识的海洋