JavaScript Regex Tester & Debugger
Test regular expressions live with instant match highlighting, capture group readout, flags (g/i/m/s), and common presets (Email, IPv4, ISO Date, URL) locally in your browser.
Safe Local Regular Expression Debugging
Testing log lines, authentication headers, or customer records on third-party regex backends risks leaking sensitive text. This tester uses your browser's native JavaScript RegExp engine completely offline—highlighting matches and counting capture groups as you type. Common flags: g (global match all), i (case-insensitive), m (multiline ^/$), and s (dot matches newline).
Essential JavaScript RegExp Flags & Pitfalls
| Flag | Effect | When to Enable |
|---|---|---|
g | Global (find all matches) | Extracting every URL, email, or log line |
i | Case-insensitive | User-typed keywords or headers |
m | Multiline (^/$ per line) | Parsing log files or CSV rows |
s | dotAll (. matches newlines) | Matching multi-line blocks |
Watch out for catastrophic backtracking (ReDoS): avoid nested quantifiers like (a+)+$ on untrusted user input.
Frequently Asked Questions
- Which regex flavor does this tester run?
- It executes your browser's native ECMAScript (JavaScript) RegExp engine locally.
- Why doesn't ^ match the start of line 2?
- Enable the multiline (m) flag so ^ and $ anchor to line breaks rather than only the start and end of the full text.
- Are sensitive logs pasted into this tester sent anywhere?
- No. All pattern matching runs strictly inside local browser memory.
Common tokens: \d matches digits, \w matches letters/numbers/underscore, + requires one or more, ? makes a quantifier lazy, and parentheses (...) capture substrings for replacement or extraction. Always verify edge cases like empty strings and multiline inputs before shipping patterns to production.