Overview
LocalRegex provides validation for various Zimbabwe identity documents and vehicle registration numbers. These validators ensure that document numbers match the official formats used in Zimbabwe.National ID Validation
isZimID()
Validates Zimbabwe national ID numbers.The national ID number to validate
bool - true if the ID number is valid, false otherwise
Pattern: ^(\d{2})(-|\s*)(\d{6,7})(\s)*([A-Za-z])(\s)*(\d{2})$
Format Structure
Zimbabwe national ID numbers follow this format:Code Examples
The validator accepts IDs with or without separators (hyphens and spaces). Whitespace is cleaned automatically during validation.
Passport Validation
isZimPassport()
Validates Zimbabwe passport numbers.The passport number to validate
bool - true if the passport number is valid, false otherwise
Pattern: ^[A-Z]{2}\d{6}$
Format Structure
Zimbabwe passports consist of:- 2 uppercase letters followed by
- 6 digits
Code Examples
Driver’s License Validation
isZimDriversLicence()
Validates Zimbabwe driver’s license numbers.The driver’s license number to validate
bool - true if the license number is valid, false otherwise
Pattern: \d{5}[a-zA-Z]{2}
Format Structure
Zimbabwe driver’s licenses consist of:- 5 digits followed by
- 2 letters (uppercase or lowercase)
Code Examples
Vehicle Number Plate Validation
isZimNumberPlate()
Validates Zimbabwe vehicle registration number plates.The number plate to validate
bool - true if the number plate is valid, false otherwise
Pattern: ^[A-Z]{3}(-|\s*)\d{4}$
Format Structure
Zimbabwe number plates consist of:- 3 uppercase letters followed by
- Optional hyphen or space followed by
- 4 digits
Code Examples
Number plates can be validated with or without separators (hyphens or spaces) between the letters and numbers.
Validation Patterns Summary
National ID
Format:
63-1234567 A 532 digits + 6-7 digits + letter + 2 digitsPassport
Format:
AB1234562 uppercase letters + 6 digitsDriver's License
Format:
12345AB5 digits + 2 lettersNumber Plate
Format:
ABC-12343 uppercase letters + 4 digitsComplete Example
Format Flexibility
- Separators
- Case Sensitivity
- Strict Validation
Most validators accept multiple separator formats:
- Hyphens:
63-1234567 A 53 - Spaces:
63 1234567 A 53 - No separators:
631234567A53
Best Practices
Input Sanitization: While the library cleans whitespace automatically, consider normalizing case (uppercase) for passports and number plates before validation.
Example: Pre-processing Input