Developer tools CLI for checking, validating, generating, and working with regular expressions and code patterns. Lint syntax, explain complex expressions, convert between formats, generate templates, diff pattern versions, preview matches, fix common regex issues, and produce reports — all from the command line with persistent local logging.
Run regexr <command> [args] to use.
CommandDescriptioncheckCheck regex patterns for correctness and common pitfallsvalidateValidate regex syntax and structuregenerateGenerate regex patterns from descriptions or examplesformatFormat and prettify regex expressionslintLint regex for style, performance, and safety issuesexplainExplain what a regex pattern does in plain languageconvertConvert regex between flavors (PCRE, JS, Python, etc.)templateApply or manage regex templates for common use casesdiffDiff two regex patterns and show behavioral differencespreviewPreview regex matches against sample textfixAuto-fix common regex issues (escaping, anchoring, etc.)reportGenerate regex quality and coverage reportsstatsShow summary statistics across all categoriesexport <fmt>Export data in json, csv, or txt formatsearch <term>Search across all logged entriesrecentShow recent activity from history logstatusHealth check — version, data dir, disk usagehelpShow help and available commandsversionShow version (v2.0.0)
Each domain command (check, validate, generate, etc.) works in two modes:
All data is stored locally in ~/.local/share/regexr/:
check.log, validate.log, generate.log)history.log tracks all activity across commandstimestamp|value pipe-delimited formatset -euo pipefail strict modedate, wc, du, tail, grep, sed, catgenerate to create patterns from descriptions, check to verify correctness, and preview to test against sample dataexplain to break down complex patterns into plain-language descriptions, perfect for code reviews or onboardinglint to catch performance and safety issues (catastrophic backtracking, unanchored patterns), then fix to auto-correct themconvert to translate patterns between JavaScript, Python, PCRE, and other flavors when porting codetemplate, generate report summaries, and export data for documentation or auditsbash
# Check a regex pattern for issues
regexr check "^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,}$ — email validation"
# Validate regex syntax
regexr validate "(?<=@)[a-z]+\.com — lookbehind syntax OK"
# Generate a pattern from description
regexr generate "match IPv4 addresses: \d{1,3}(\.\d{1,3}){3}"
# Explain a complex regex
regexr explain "^(?=.*[A-Z])(?=.*\d).{8,}$ — password: 1 uppercase, 1 digit, 8+ chars"
# Lint for performance issues
regexr lint "(a+)+ — warning: catastrophic backtracking possible"
# Convert between flavors
regexr convert "JS→Python: /\d+/g becomes re.findall(r'\d+', text)"
# Fix common issues
regexr fix "added anchors: ^pattern$ and escaped special chars"
# Preview matches
regexr preview "pattern=[0-9]{3}-[0-9]{4} matched: 555-1234, 800-9999"
# View summary statistics
regexr stats
# Export all data as JSON
regexr export json
# Search logged patterns
regexr search "email"
All commands output to stdout. Redirect to a file if needed:
bash
regexr report "weekly pattern audit" > report.txt
regexr export csv # saves to ~/.local/share/regexr/export.csv
Set DATA_DIR by modifying the script, or use the default: ~/.local/share/regexr/
Powered by BytesAgain | bytesagain.com | hello@bytesagain.com