当前位置:网站首页>正则及常用公式
正则及常用公式
2022-07-02 07:13:00 【LHT-2787】
正则基本符号
^:起始符号,^x表示以x开头
$:结束符号,x$表示以x结尾
[n-m]:表示从n到m的数字
\d:表示数字,等同于[0-9]
X{m}:表示由m个X字符构成
身份证
18位身份证的构成:六位出生地区码+八位出生日期码+三位顺序码+一位校验码
isIDCard=/^[1-9]\d{
5}[1-9]\d{
3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{
4}$/;
[1-9]\d{5}:六位出生地区码,出生地区码没有以0开头,因此第一位为[1-9]。
[1-9]\d{3}:八位出生日期码的四位年份,同样年份没有以0开头。
((0\d)|(1[0-2])):八位出生日期码的两位月份,| 表示或者,月份的形式为0\d或者是10、11、12。
(([0|1|2]\d)|3[0-1]):八位出生日期码的两位日期,日期由01至31。
\d{4}:三位顺序码+一位校验码,共四位。
15位身份证的构成:六位出生地区码+六位出身日期码+三位顺序码
isIDCard=/^[1-9]\d{
7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{
3}$/;
[1-9]\d{7}:六位出生地区码+两位出生日期码的年份,这里的年份指后两位,因此没有第一位不能为0的限制,所以合并了。
后面的与18位类似了。
边栏推荐
- Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
- PCL之滤波
- Rapid prototyping
- Windows环境MySQL8忘记密码文件解决方案
- Webui automated learning
- flume 190 INSTALL
- UVM - configuration mechanism
- 【TS】1368- 秒懂 TypeScript 泛型工具类型!
- 记录 AttributeError: ‘NoneType‘ object has no attribute ‘nextcall‘
- How to get the password of cpolar?
猜你喜欢
Operator-1 first acquaintance with operator
LeetCode+ 76 - 80 暴搜专题
SPSS做Shapiro-Wilk正态分析
"Talking about podcasts" vol.352 the age of children: breaking the inner scroll, what can we do before high school?
Retrofit's callback hell is really vulnerable in kotlin synergy mode!
2.hacking-lab脚本关[详细writeup]
Sus system availability scale
13.信号量临界区保护
MPLS experiment
《实习报告》Skywalking分布式链路追踪?
随机推荐
Mysql database remote access permission settings
Sum the two numbers to find the target value
How to get the password of cpolar?
转换YV12到RGB565图像转换,附YUV转RGB测试
Considerations for Apache deploying static web page projects
01安装虚拟机
js setTimeout()与面试题
从MediaRecord录像中读取H264参数
Open the encrypted SQLite method with sqlcipher
Network communication learning
13.信号量临界区保护
UWA报告使用小技巧,你get了吗?(第四弹)
LeetCode+ 76 - 80 暴搜专题
12. Process synchronization and semaphore
flink 提交程序
Kustomize使用手册
拆解美图SaaS:开着飞机换引擎
Pywin32 opens the specified window
Transport Optimization abstraction
数据库字典Navicat自动生成版本