← Back to all products

Data Validator

$19

Comprehensive form data validation for emails, phones, URLs, credit cards, and more.

📁 10 files
JSONMarkdownPython

📄 Product Preview

Try the interactive reader and demo tools below, or get the full product with all content unlocked.

📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample

📁 File Structure 10 files

data-validator/ ├── LICENSE ├── README.md ├── examples/ │ └── validation_rules.json ├── free-sample.zip ├── guide/ │ ├── 01_features.md │ ├── 02_cli-reference.md │ ├── 03_programmatic-usage.md │ └── 04_file-structure.md ├── index.html └── src/ └── data_validator.py

📖 Documentation Preview README excerpt

Data Validator

Comprehensive form data validation — emails, phones, URLs, credit cards, and more. Pure Python, zero dependencies.

Part of the [Form Forge](https://form-forge.codevault.dev) toolkit by CodeVault.

Features

  • 12 built-in validators: email, phone, URL, credit card (Luhn algorithm), IP address, date, password strength, slug, UUID, hex color, length, regex
  • Bulk validation: validate entire form submissions against a rules schema
  • Strict mode: tighter validation rules for production use
  • Disposable email detection: block temporary/throwaway email domains
  • JSON output: machine-readable validation results for API integration
  • Custom regex rules: define your own patterns via JSON rule files
  • Python 3.10+ stdlib only — no pip installs required

Quick Start


# 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 --demo

CLI Reference

FlagDescription
--email VALUEValidate an email address
--phone VALUEValidate a phone number
--url VALUEValidate a URL
--credit-card VALUEValidate a credit card number (Luhn)
--ip VALUEValidate an IP address (v4 or v6)
--date VALUEValidate a date string
--password VALUECheck password strength
--slug VALUEValidate a URL slug
--uuid VALUEValidate a UUID
--color VALUEValidate a hex color code
--strictEnable strict validation mode
--jsonOutput results as JSON
--rules FILEBulk validate using a JSON rules file
--demoRun built-in validation demos

Validation Rules Schema

Define validation rules in JSON for bulk validation:

... continues with setup instructions, usage examples, and more.

📄 Code Sample .py preview

src/data_validator.py #!/usr/bin/env python3 """ Data Validator — Comprehensive Form Data Validation ==================================================== Validate emails, phones, URLs, credit cards, dates, and more using only Python stdlib. Supports custom regex patterns, chained validators, and detailed error reporting. Part of the Form Forge toolkit by DataNest. License: MIT """ from __future__ import annotations import argparse import ipaddress import json import logging import re import sys from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Any, Callable logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") logger = logging.getLogger(__name__) # --------------------------------------------------------------------------- # Constants — compiled regex patterns for performance # --------------------------------------------------------------------------- # RFC 5322 simplified email pattern (covers 99.9% of real-world emails) EMAIL_RE = re.compile( r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@" r"[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?" r"(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$" ) # E.164 international phone format (with optional formatting characters) PHONE_RE = re.compile(r"^\+?[1-9]\d{1,14}$") PHONE_LOOSE_RE = re.compile(r"^[\+\d\s\-\(\)\.]{7,20}$") # URL pattern (HTTP/HTTPS with optional port, path, query, fragment) URL_RE = re.compile( r"^https?://" r"(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}|" r"localhost|" r"\d{1,3}(?:\.\d{1,3}){3})" r"(?::\d{1,5})?" r"(?:/[^\s]*)?$" # ... 404 more lines ...
Buy Now — $19 Back to Products