当前位置:网站首页>正则及常用公式
正则及常用公式
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位类似了。
边栏推荐
猜你喜欢

Read H264 parameters from mediarecord recording

4. Random variables

Pytest learning --base

Pytest framework implements pre post

js数组常用方法

Use WinDbg to statically analyze dump files (summary of practical experience)
![[pit avoidance guide] pit encountered using ugui: the text component cannot indent the first line by two spaces](/img/6f/e5a30dae824ccb22d1157818be58be.png)
[pit avoidance guide] pit encountered using ugui: the text component cannot indent the first line by two spaces

Session cookies and tokens

Test -- Summary of interview questions

Mysql database remote access permission settings
随机推荐
互联网快讯:腾讯会议应用市场正式上线;Soul赴港递交上市申请书
MySQL数据库远程访问权限设置
使用sqlcipher打开加密的sqlite方法
UWA report uses tips. Did you get it? (the fourth bullet)
Operator-1初识Operator
[SUCTF2018]followme
Is this code PHP MySQL redundant?
4.随机变量
UVM factory mechanism
AI技术产业热点分析
shell编程01_Shell基础
13.信号量临界区保护
Network communication learning
PCL 点云转深度图像
Internet News: Tencent conference application market was officially launched; Soul went to Hong Kong to submit the listing application
Easyexcel, a concise, fast and memory saving excel processing tool
flume 190 INSTALL
02-taildir source
4. Random variables
数据库字典Navicat自动生成版本