vincentsit/chinamobilephonenumberregex — explained in plain English
Analysis updated 2026-06-26
Validate a phone number field in a sign-up form to ensure users enter a real Chinese mobile number
Filter or segment a contact list by number type, such as separating IoT SIMs from regular mobile numbers
Add server-side phone number validation to a backend written in Python, JavaScript, Java, or any other language
Check whether a submitted number belongs to a known mainland China prefix range before sending an SMS
| vincentsit/chinamobilephonenumberregex | biaochenxuying/blog | fogleman/gg | |
|---|---|---|---|
| Stars | 4,772 | 4,772 | 4,772 |
| Language | — | HTML | Go |
| Setup difficulty | easy | easy | easy |
| Complexity | 1/5 | 3/5 | 2/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
No installation needed. Copy the relevant regex pattern from the README directly into your project. Test instantly using the linked online regex tools.
This repository is a collection of regular expressions for validating and matching mobile phone numbers from mainland China. A regular expression is a compact pattern that a program can use to check whether a string of text matches a specific format. These patterns are language-agnostic, meaning developers can copy them directly into projects written in Python, JavaScript, Java, or nearly any other programming language. China's phone system is more complex than most countries because it separates numbers by carrier, number type, and service capability. The repository covers standard mobile phone numbers from the four main carriers (China Mobile, China Unicom, China Telecom, and China Broadcast Network), as well as MVNO numbers (virtual operators who resell capacity on those networks), IoT numbers (13-digit SIM slots used in connected devices), and data-only numbers (SIMs that may not support voice calls). Separate patterns are provided for each category so developers can match the exact subset they need, or use a single catch-all pattern if any valid mainland number will do. One important caveat is noted clearly in the README: since December 2019, China has allowed mobile number portability, meaning customers can switch carriers while keeping the same number. As a result, matching a number against a carrier-specific pattern will tell you what prefix range the number came from originally, not necessarily the carrier the person uses today. The maintainer flags this limitation openly and notes there is no technical workaround. The repository also includes links to online tools where you can paste a number and test a pattern in real time, a reference table listing which number prefixes belong to which carriers, and a release history showing how the patterns have grown over the years as new number ranges were assigned by China's Ministry of Industry and Information Technology. The project is actively maintained, released under the MIT license, and accepts community pull requests for new prefix additions.
A collection of copy-paste regular expressions for validating Chinese mobile phone numbers, covering all four major carriers, MVNOs, IoT SIMs, and data-only numbers. Works in any programming language. Includes a carrier prefix reference table and a note that number portability since 2019 means carrier detection is unreliable.
MIT license, free to use, copy, modify, and distribute in any project, personal or commercial. No restrictions.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.