Build, test, and debug regular expressions
This regex validates Chinese Resident Identity Card numbers, supporting both the current 18-digit format and the legacy 15-digit format. It checks the structure including address code (first 6 digits), birth date (year, month, day), and sequence/check digits. The 18-digit variant allows 'X' as the final checksum character, while the 15-digit version represents the older format without the birth century or check digit.