Launching a SaaS?·Collect waitlist signups before you build — before.run
SandboxPatternsDetectDocsChangelog
Identity
zh-CN
#china
#chinese
#resident-id
#identity

Chinese Resident ID

Matches a Chinese national resident identity card number — 17 digits followed by one digit or X (checksum digit).

Chinese government integrationKYC for Chinese usersTravel booking
/
/
Safe
Test String
2 matches
\d{17}digit\d — digit (0–9) — repeated exactly 17 times · {17} — exactly 17 times
[…]Character class […]Matches any single character listed in this set
\ddigit\d — digit (0–9)
XX'X' — literal character
xx'x' — literal character
Pattern: 12 charsInput: 37 chars
100% client-side · private

Valid Examples

  • 11010519491231002X
  • 440301198001012158

Invalid Examples

  • 11010519491231002
  • 1101051949123100200
  • 1101051949123100Y

Usage & Integration

Validate Chinese Resident ID natively in your backend or frontend without copying regex strings.

Node / Edge

import { validate } from '@regexto/validators';

validate('cn-resident-id', '...');

Python

from regexto_validators import validate

validate("cn-resident-id", "...")

Go

import "github.com/regex-to/validators-go"

valid, err := validators.Validate("cn-resident-id", "...")

PHP

use RegexTo\Validators\Validator;

Validator::validate('cn-resident-id', '...');

Rust

use regexto_validators::validate;

let is_valid = validate("cn-resident-id", "...").unwrap();