This chapter covers the core features and capabilities of Data Validator.
# Validate a single email
python src/data_validator.py --email user@example.com
# Validate a phone number
python src/data_validator.py --phone "+1-555-123-4567"
# Validate a credit card (Luhn check)
python src/data_validator.py --credit-card 4111111111111111
# Validate a URL
python src/data_validator.py --url "https://api.example.com/v1/users"
# Bulk validate with rules
python src/data_validator.py --rules examples/validation_rules.json
# Run built-in demo
python src/data_validator.py --demoFollow this guide to get Data Validator up and running in your environment.
| Flag | Description |
|---|---|
--email VALUE | Validate an email address |
--phone VALUE | Validate a phone number |
--url VALUE | Validate a URL |
--credit-card VALUE | Validate a credit card number (Luhn) |
--ip VALUE | Validate an IP address (v4 or v6) |
--date VALUE | Validate a date string |
--password VALUE | Check password strength |
--slug VALUE | Validate a URL slug |
--uuid VALUE | Validate a UUID |
--color VALUE | Validate a hex color code |
--strict | Enable strict validation mode |
--json | Output results as JSON |
--rules FILE | Bulk validate using a JSON rules file |
--demo | Run built-in validation demos |
Define validation rules in JSON for bulk validation:
{
"fields": {
"email": {
"value": "user@example.com",
"rules": ["required", "email"]
},
"password": {
"value": "MyS3cur3P@ss!",
"rules": ["required", "password_strength", {"min_length": 8}]
},
"website": {
"value": "https://example.com",
"rules": ["url"]
},
"phone": {
"value": "+15551234567",
"rules": ["phone"]
}
}
}| Rule | Description |
|---|---|
required | Field must not be empty |
email | Valid email format (RFC 5322 simplified) |
phone | Valid phone number (E.164 or loose format) |
url | Valid HTTP/HTTPS URL |
credit_card | Valid card number via Luhn algorithm |
ip_address | Valid IPv4 or IPv6 address |
date | Valid date string (multiple formats) |
password_strength | Password complexity check |
slug | URL-safe slug (lowercase, hyphens, no spaces) |
uuid | Valid UUID v1-v5 |
hex_color | Valid hex color (#RGB or #RRGGBB) |
min_length | Minimum character length |
max_length | Maximum character length |
regex | Custom regex pattern match |
Get the full Data Validator and unlock everything.
Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.
Access all interactive tools with complete data, all workload profiles, and the full scenario library.
Downloadable source code, configuration files, and working examples from every chapter.
Free updates for life. Every new chapter, tool, and improvement included.