Regular Expression (Regex) Auditor
Test pattern match behaviors against sample code blocks, highlighting targets in real time.
How It Works
- Enter a Regular Expression pattern and optional flags (g, i, m, s, u).
- Enter test text in the input box.
- The engine highlights matches in real time, details capture groups, and provides a plain-English explanation of regex token mechanics.
Primary Use Cases
- Developing and testing input validation patterns for web forms and security filters.
- Extracting log data, IP addresses, and email strings from complex unstructured text.
- Debugging regex Denial of Service (ReDoS) vulnerability risks before deployment.
Common Security Pitfalls
- Writing catastrophic backtracking regex patterns that cause CPU spikes when processing malicious inputs (ReDoS).
- Forgetting to anchor patterns with ^ and $, allowing attackers to append malicious payloads before or after valid matches.
Frequently Asked Questions
- What is a ReDoS (Regular Expression Denial of Service) attack?
- ReDoS occurs when a regular expression contains nested quantifiers with overlapping sub-patterns, causing exponential backtracking that freezes server CPU resources when given a crafted input.
- What does the global (g) flag do in regex?
- The global flag causes the regex engine to search for all matches in the text rather than stopping after finding the very first match.
References & Standards