Regex Tester & Debugger
Test, build, and debug regular expressions in real time with live match highlighting, group extraction, and cheat sheet.
Regex Tester & Debugger
Test JavaScript regular expressions with real-time match highlighting & capture groups.
What is the Regex Tester & Debugger?
The Regex Tester is a real-time interactive regular expression engine for JavaScript developers. Regular expressions (regex) are pattern-matching strings used across input validation, text scraping, search-and-replace, and data extraction. However, writing and debugging complex regex patterns without real-time visual feedback leads to subtle bugs and catastrophic backtracking.
This tool executes your JavaScript Regular Expression against sample test text instantly, highlighting all matches, capture groups, match counts, and character indexes as you type.
Key Features
- Real-Time Match Highlighting: Matches are highlighted directly inside the sample text with alternating color bands for capture groups.
- Flag Toggles: Toggle flags with a click: `g` (global), `i` (case-insensitive), `m` (multiline), `s` (dotAll), `u` (unicode).
- Match & Group Details Table: View a structured table listing match index, match string, and individual capture groups (`$1`, `$2`).
- Common Pattern Preset Library: Load pre-built regex patterns for Email validation, URL parsing, Phone numbers, IPv4 addresses, Hex colors, and ISO dates.
- Regex Cheat Sheet: Built-in quick reference guide for quantifiers, character classes, anchors, lookaheads, and flags.
How Does the Regex Tester & Debugger Work?
1. Enter your Regex Pattern in the expression field (e.g. `([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})`).
2. Toggle Flags: Select `g` (global), `i` (ignore case), or `m` (multiline).
3. Type or Paste Test Text into the test input area.
4. Inspect Matches: See live highlighted matches and check the Capture Groups table.
5. Use Presets: Click any preset button (Email, URL, IP) to populate verified regex patterns.
Formula & Calculation Method
Regex Execution:
Instantiated via `new RegExp(pattern, flags)`.
Matches extracted using `string.matchAll(regex)` or `regex.exec(string)` loops.
Capturing Group Index:
- `Group 0`: The entire matched substring.
- `Group N`: Substring matched by the N-th set of parentheses `(...)`.
Example Calculation
Pattern: `/(\d{4})-(\d{2})-(\d{2})/g`
Test Text: "Created on 2026-03-19 and updated on 2026-07-21"
- Match 1: "2026-03-19" (Index: 11)
- Group 1 ($1): "2026" (Year)
- Group 2 ($2): "03" (Month)
- Group 3 ($3): "19" (Day)
- Match 2: "2026-07-21" (Index: 39)
- Total Matches: 2
Frequently Asked Questions
**Regex Execution:** Instantiated via `new RegExp(pattern, flags)`. Matches extracted using `string.matchAll(regex)` or `regex.exec(string)` loops. **Capturing Group Index:** - `Group 0`: The entire matched substring. - `Group N`: Substring matched by the N-th set of parentheses `(...)`.
Disclaimer: All developer utilities run 100% locally in your browser. None of your code, tokens, passwords, or input data are sent to or stored on remote servers.