当前位置:网站首页>【正则】判断, 手机号,身份证号
【正则】判断, 手机号,身份证号
2022-07-27 01:43:00 【嘿,小苹果】
1, 只能输入手机号,并且以英文逗号隔开
oninput() {
this.checkMobile(this.phone)
},
checkMobile(str) {
var Tel = /^((\+?86)|(\(\+86\)))?\d{3,4}-\d{7,8}(-\d{3,4})?$/
var fu = /(((1[73584]\d{9}))\,){0,}((1[73584]\d{9}))$/
if (Tel.test(str) || fu.test(str)) {
//是手机
} else {
//匹配失败
this.$message.error('手机号格式不正确')
}
},
2, 验证 身份证号
var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if(reg.test(this.idNumber) === false){
this.$toast('请输入正确的身份证号');
return false;
}
身份证号,生日 显示星号**** 代替
// 使用
this.changeIdCardIncludeStart(this.idNumber)
changeIdCardIncludeStart (cardId) {
const newStr = cardId.replace(/^(.{6})(?:\d+)(.{4})$/,"$1****$2");
return newStr;
},
边栏推荐
- $128million! IQM, a Finnish quantum computing company, was supported by the world fund
- Worthington果胶酶的特性及测定方案
- Technology vane | interpretation of cloud native technology architecture maturity model
- On the prototype of constructor
- Comprehensive care analysis lyriq Ruige battery safety design
- 优炫数据库集群如何唯一标识一条用户SQL
- 安全员及环保员岗位职责
- [flask] the server obtains the request header information of the client
- [1206. Design skip table]
- 如何进行 360 评估
猜你喜欢
随机推荐
Single case mode (double check lock)
be based on. NETCORE development blog project starblog - (16) some new functions (monitoring / statistics / configuration / initialization)
Portraiture5 new and upgraded leather filter plug-in artifact
二叉树(DAY 82)
Explain详解
Take you to know what Web3.0 is
Message rejected MQ
Spark Learning Notes (IV) -- spark core programming RDD
The diagram of user login verification process is well written!
How to uniquely identify a user SQL in Youxuan database cluster
Technology vane | interpretation of cloud native technology architecture maturity model
基于.NetCore开发博客项目 StarBlog - (16) 一些新功能 (监控/统计/配置/初始化)
将幕布文章OPML转换为Markdown的方法
索引最佳实践
积分发放带给商家的两个帮助
[learning notes, dog learning C] string + memory function
Worthington果胶酶的特性及测定方案
Mysql: summary of common sub database and sub table schemes of Internet companies
Unity game, the simplest solution of privacy agreement! Just 3 lines of code! (Reprinted)
Volatile keyword and its function


![[1206. Design skip table]](/img/a9/ca45c9fedd6e48387821bdc7ec625c.png)






