当前位置:网站首页>【正则】判断, 手机号,身份证号
【正则】判断, 手机号,身份证号
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;
},
边栏推荐
- 深入理解Mysql索引底层数据结构与算法
- [1206. Design skip table]
- [flask] the server obtains the file requested by the client
- Portraiture5 new and upgraded leather filter plug-in artifact
- shell awk
- 再学RecyclerView的回收复用机制
- 数据库概论 - 数据库的介绍
- spark:地区广告点击量排行统计(小案例)
- 架构基本概念和架构本质
- It's too strong. An annotation handles the data desensitization returned by the interface
猜你喜欢

Explain

Practice of online problem feedback module (XV): realize the function of online updating feedback status

记录一次,php程序访问系统文件访问错误的问题

图解用户登录验证流程,写得太好了!

注解@Autowired和@Resource的区别总结

The diagram of user login verification process is well written!

Deeply understand the underlying data structure and algorithm of MySQL index

索引最佳实践

Abbkine AbFluor 488 细胞凋亡检测试剂盒特点及实验建议

30 minutes to thoroughly understand the synchronized lock upgrade process
随机推荐
vector 转 svg 方法
Wechat applet generation Excel
Safe-arc/warner power supply maintenance xenon lamp power supply maintenance analysis
Does Oracle have a distributed database?
pip3 设置阿里云
AcWing 2074. 倒计数 模拟
最大连续子序列(DAY 77)
DNS记录类型及相关名词解释
图解用户登录验证流程,写得太好了!
[understanding of opportunity -52]: the depth of communication varies from person to person
代码审查金字塔
Annotation summary of differences between @autowired and @resource
opiodr aborting process unknown ospid (21745) as a result of ORA-609
Portraiture5 new and upgraded leather filter plug-in artifact
On the prototype of constructor
Bulk copy baby upload prompt garbled, how to solve?
Hcip day 14 notes
再学RecyclerView的回收复用机制
Naive Bayes -- Document Classification
Data Lake (20): Flink is compatible with iceberg, which is currently insufficient, and iceberg is compared with Hudi