当前位置:网站首页>常用正则表达式整理
常用正则表达式整理
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的数字,最多保留四位小数'
}
}
};
边栏推荐
- Deoldify project problem - omp:error 15:initializing libiomp5md dll,but found libiomp5md. dll already initialized.
- Remember a company interview question: merge ordered arrays
- 數據庫高級學習筆記--SQL語句
- 学习问题1:127.0.0.1拒绝了我们的访问
- Introduction and use of automatic machine learning framework (flaml, H2O)
- Armv8-a programming guide MMU (2)
- Did you forget to register or load this tag 报错解决方法
- [蓝桥杯2017初赛]包子凑数
- Vs2019 use wizard to generate an MFC Application
- [BSidesCF_2020]Had_a_bad_day
猜你喜欢

QT creator custom build process

Integration test practice (1) theoretical basis
C语言读取BMP文件

QT creator design user interface

When you open the browser, you will also open mango TV, Tiktok and other websites outside the home page

连接MySQL数据库出现错误:2059 - authentication plugin ‘caching_sha2_password‘的解决方法

PHP - whether the setting error displays -php xxx When PHP executes, there is no code exception prompt

Did you forget to register or load this tag

Mtcnn face detection

02-项目实战之后台员工信息管理
随机推荐
打开浏览器的同时会在主页外同时打开芒果TV,抖音等网站
Base de données Advanced Learning Notes - - SQL statements
L2-006 tree traversal (25 points)
项目实战-后台员工信息管理(增删改查登录与退出)
Dotnet replaces asp Net core's underlying communication is the IPC Library of named pipes
MTCNN人脸检测
How to configure flymcu (STM32 serial port download software) is shown in super detail
Windows下安装MongDB教程、Redis教程
Ansible practical series I_ introduction
Error reporting solution - io UnsupportedOperation: can‘t do nonzero end-relative seeks
连接MySQL数据库出现错误:2059 - authentication plugin ‘caching_sha2_password‘的解决方法
MySQL与c语言连接(vs2019版)
Vs2019 use wizard to generate an MFC Application
Machine learning -- census data analysis
[蓝桥杯2017初赛]方格分割
ES6 Promise 对象
Install mongdb tutorial and redis tutorial under Windows
01 project demand analysis (ordering system)
neo4j安装教程
How to set up voice recognition on the computer with shortcut keys