


What are the regular writing methods for 15/18-digit ID number verification?
This time I will bring you what are the regular writing methods for 15/18-digit ID card number verification, what are the precautions, and the following are practical cases, one Get up and take a look.
Preface
During the development process, it is often necessary to verify the validity of some input information, using regular expressions Verification is the simplest and most efficient way. Let’s take a look at the regular expression for 15/18-digit ID number verification.
Introduction
##xxxxxx yyyy MM dd 375 0 18 digitsxxxxxx yy MM dd 75 0 15 digitsRegion:[1-9]\d{5}
(18|19|([23]\d) ) 1800-2399 The last two digits of the year
\d{2}
((0[1-9]) | (10 | 11 | 12))
## Day:
不Forbidden 29+ Three-digit sequence code:
Two-digit sequence code:
Check code:
Regular expressionEighteen digits:
^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))( ([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$Fifteenth digit:
Total:(
^[1-9]\ d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1- 9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9] )|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)
Simple JS verification examplefunction isCardNo(card)
{
// 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if(reg.test(card) === false)
{
alert("身份证输入不合法");
return false;
}
}
I believe you have mastered the method after reading the case in this article, please pay attention for more exciting things Other related articles on php Chinese website!
Recommended reading:
Analysis of the principles and syntax of JS regularityPictures of using regular multi-line mode and single-line mode Detailed text explanationThe above is the detailed content of What are the regular writing methods for 15/18-digit ID number verification?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











An ID card can only open one Taobao store. Sellers should abide by the regulations of the Taobao platform and do not try to use other people's ID cards to open multiple stores. Sellers can expand their business and increase sales by merging stores and opening branches. However, it should be noted that each branch needs to use an independent ID card for real-name authentication.

Golang regular expressions use the pipe character | to match multiple words or strings, separating each option as a logical OR expression. For example: matches "fox" or "dog": fox|dog matches "quick", "brown" or "lazy": (quick|brown|lazy) matches "Go", "Python" or "Java": Go|Python |Java matches words or 4-digit zip codes: ([a-zA

PHP regular expressions are a powerful tool for text processing and conversion. It can effectively manage text information by parsing text content and replacing or intercepting it according to specific patterns. Among them, a common application of regular expressions is to replace strings starting with specific characters. We will explain this as follows

What games can be played with i34150 with 1G independent graphics? Can it play small games such as LoL? GTX750 and GTX750TI are very suitable graphics card choices. If you just play some small games or not play games, it is recommended to use the i34150 integrated graphics card. Generally speaking, the price difference between graphics cards and processors is not very big, so it is important to choose a reasonable combination. If you need 2G of video memory, it is recommended to choose GTX750TI; if you only need 1G of video memory, just choose GTX750. GTX750TI can be seen as an enhanced version of GTX750, with overclocking capabilities. Which graphics card can be paired with i34150 depends on your needs. If you plan to play stand-alone games, it is recommended that you consider changing the graphics card. you can choose

How to remove Chinese in PHP using regular expressions: 1. Create a PHP sample file; 2. Define a string containing Chinese and English; 3. Use "preg_replace('/([\x80-\xff]*)/i', '',$a);" The regular method can remove Chinese characters from the query results.

In this article, we will learn how to remove HTML tags and extract plain text content from HTML strings using PHP regular expressions. To demonstrate how to remove HTML tags, let's first define a string containing HTML tags.

Mobile phones and ID cards will not be demagnetized together. The reasons are: 1. There are coils and chips integrated inside the ID card. Unlike traditional tapes, hard drives and other storage media, there are no magnetized substances; 2. The electromagnetic radiation of mobile phones is high. Frequency electromagnetic waves, with frequencies as high as hundreds of thousands to tens of millions of Hertz, have no ability to magnetize ID cards. The magnets in the mobile phone speakers will not have a demagnetizing effect on the ID card. We can safely put the ID card and mobile phone together, and pay attention to avoid damage to the ID card and protect its normal use so that it can serve us better.

PHP regular replacement examples: quickly master replacement skills. With the development of the Internet, website development has become more and more common. In website development, it is often necessary to replace strings, and regular expressions are a very powerful tool that can quickly search and replace strings. This article will introduce how to use regular expressions in the PHP language to perform replacement operations, and provide specific code examples to help readers quickly master replacement techniques. 1.preg_replace function in PHP, you can use preg
