当前位置:网站首页>正则及常用公式
正则及常用公式
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位类似了。
边栏推荐
- Leetcode+ 76 - 80 storm search topic
- Solution of mysql8 forgetting password file in Windows Environment
- Windows环境MySQL8忘记密码文件解决方案
- js promise. all
- 01安装虚拟机
- 618再次霸榜的秘密何在?耐克最新财报给出答案
- (5) Gear control setting of APA scene construction
- [Fantasy 4] introduction and use of UMG components (under update...)
- 12.进程同步与信号量
- 面对不确定性,供应链的作用
猜你喜欢
随机推荐
MYSQL关键字
Merge ordered sequence
JS reduce accumulator
Convert yv12 to rgb565 image conversion, with YUV to RGB test
Retrofit's callback hell is really vulnerable in kotlin synergy mode!
[jetbrain rider] an exception occurred in the construction project: the imported project "d:\visualstudio2017\ide\msbuild\15.0\bin\roslyn\microsoft.csh" was not found
Open the encrypted SQLite method with sqlcipher
[unity3d] production progress bar - make image have the functions of filled and sliced at the same time
What are the popular frameworks for swoole in 2022?
UVM——Callback
Considerations for Apache deploying static web page projects
PCL之滤波
Redis set password
Read H264 parameters from mediarecord recording
2021-10-02
SPSS做Shapiro-Wilk正态分析
07 data import sqoop
618 what is the secret of dominating the list again? Nike's latest financial report gives the answer
Sum the two numbers to find the target value
Excuse me, is it cost-effective to insure love life patron saint 2.0 increased lifelong life insurance? What are the advantages of this product?









