当前位置:网站首页>常用正则表达式整理
常用正则表达式整理
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的数字,最多保留四位小数'
}
}
};
边栏推荐
- 软件测试-面试题分享
- 天梯赛练习集题解LV1(all)
- 保姆级出题教程
- When using lambda to pass parameters in a loop, the parameters are always the same value
- Install mongdb tutorial and redis tutorial under Windows
- L2-001 emergency rescue (25 points)
- Learn winpwn (3) -- sEH from scratch
- One click extraction of tables in PDF
- ES6 let and const commands
- neo4j安装教程
猜你喜欢
Error connecting to MySQL database: 2059 - authentication plugin 'caching_ sha2_ The solution of 'password'
vs2019 第一个MFC应用程序
安装numpy问题总结
QT creator create button
How to configure flymcu (STM32 serial port download software) is shown in super detail
保姆级出题教程
MySQL与c语言连接(vs2019版)
Reading BMP file with C language
[download app for free]ineukernel OCR image data recognition and acquisition principle and product application
Leetcode 461 Hamming distance
随机推荐
How to build a new project for keil5mdk (with super detailed drawings)
Valentine's Day flirting with girls to force a small way, one can learn
[free setup] asp Net online course selection system design and Implementation (source code +lunwen)
Introduction and use of automatic machine learning framework (flaml, H2O)
[NPUCTF2020]ReadlezPHP
Why can't STM32 download the program
UDS learning notes on fault codes (0x19 and 0x14 services)
Solution to the practice set of ladder race LV1 (all)
About string immutability
Mtcnn face detection
Niuke novice monthly race 40
01项目需求分析 (点餐系统)
L2-007 家庭房产 (25 分)
AcWing 242. A simple integer problem (tree array + difference)
Remember the interview algorithm of a company: find the number of times a number appears in an ordered array
Antlr4 uses keywords as identifiers
QT creator custom build process
搞笑漫画:程序员的逻辑
项目实战-后台员工信息管理(增删改查登录与退出)
QT creator uses Valgrind code analysis tool