Install
openclaw skills install regexguardRegex safety & correctness analyzer -- detects catastrophic backtracking, portability errors, correctness bugs, maintainability issues, anchoring problems, a...
openclaw skills install regexguardRegexGuard scans codebases for regex anti-patterns: catastrophic backtracking (ReDoS), portability errors across engines, correctness bugs, maintainability issues, anchoring and boundary problems, and pattern injection risks. It uses regex-based pattern matching against 90 regex-specific patterns across 6 categories, lefthook for git hook integration, and produces markdown reports with actionable remediation guidance. 100% local. Zero telemetry.
Note: RegexGuard focuses on regex patterns found in source code (JavaScript, Python, Go, Java, Ruby, shell scripts, config files). It detects anti-patterns in how regexes are written, constructed, and used.
regexguard scan [file|directory]One-shot regex safety scan of files or directories.
How to execute:
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [target]
What it does:
Example usage scenarios:
regexguard scan .regexguard scan src/validators.tsregexguard scan src/regexguard scan .regexguard scan .regexguard scan --tier pro [file|directory]Extended scan with 60 patterns covering backtracking, portability, correctness, and maintainability.
How to execute:
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [target] --tier pro
What it does:
regexguard scan --format json [directory]Generate JSON output for CI/CD integration.
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [directory] --format json
regexguard scan --format html [directory]Generate HTML report for browser viewing.
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [directory] --format html
regexguard scan --category CB [directory]Filter scan to a specific check category (CB, PE, CE, MA, AN, PI).
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [directory] --category CB
regexguard scan --tier team [directory]Full scan with all 90 patterns across all 6 categories including anchoring and injection.
How to execute:
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [directory] --tier team
What it does:
regexguard scan --verbose [directory]Verbose output showing every matched line and pattern details.
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [directory] --verbose
regexguard statusShow license and configuration information.
bash "<SKILL_DIR>/scripts/dispatcher.sh" status
regexguard patternsList all 90 detection patterns across all categories.
bash "<SKILL_DIR>/scripts/dispatcher.sh" patterns
RegexGuard detects 90 regex anti-patterns across 6 categories:
| Category | Code | Patterns | Description | Severity Range |
|---|---|---|---|---|
| Catastrophic Backtracking | CB | 15 | Nested quantifiers, exponential patterns, ReDoS vectors, overlapping greed | low -- critical |
| Portability Errors | PE | 15 | Non-POSIX features, engine-specific syntax, lookbehind gaps, Unicode escapes | low -- high |
| Correctness Errors | CE | 15 | Unescaped dots, bad character class ranges, greedy vs lazy, redundant quantifiers | low -- high |
| Maintainability Issues | MA | 15 | Overly complex patterns, missing comments, duplication, magic regex strings | low -- high |
| Anchoring & Boundaries | AN | 15 | Missing ^/$, \b misuse, multiline flag gaps, validation anchor bypass | low -- critical |
| Pattern Injection | PI | 15 | Unsanitized user input in regex, string concat into RegExp, DoS vectors | low -- critical |
| Tier | Patterns | Categories |
|---|---|---|
| Free | 30 | CB, PE |
| Pro | 60 | CB, PE, CE, MA |
| Team | 90 | CB, PE, CE, MA, AN, PI |
| Enterprise | 90 | CB, PE, CE, MA, AN, PI + priority support |
RegexGuard uses a deductive scoring system starting at 100 (perfect):
| Severity | Point Deduction | Description |
|---|---|---|
| Critical | -25 per finding | Severe risk (ReDoS, injection, missing validation anchors) |
| High | -15 per finding | Significant problem (portability bugs, correctness errors) |
| Medium | -8 per finding | Moderate concern (engine-specific features, maintainability) |
| Low | -3 per finding | Informational / best practice suggestion |
| Grade | Score Range | Meaning |
|---|---|---|
| A | 90-100 | Excellent regex quality |
| B | 80-89 | Good patterns with minor issues |
| C | 70-79 | Acceptable but needs improvement |
| D | 60-69 | Poor regex quality |
| F | Below 60 | Critical regex problems |
Users can configure RegexGuard in ~/.openclaw/openclaw.json:
{
"skills": {
"entries": {
"regexguard": {
"enabled": true,
"apiKey": "YOUR_LICENSE_KEY_HERE",
"config": {
"severityThreshold": "medium",
"ignorePatterns": ["**/test/**", "**/fixtures/**", "**/*.test.*"],
"ignoreChecks": [],
"reportFormat": "text"
}
}
}
}
}
The user might say things like:
brew install lefthook