Live JavaScript RegExp Debugger

Online Regex Tester & Pattern Debugger

Test regular expressions in real time with match highlighting, capture group inspection, flag toggles, and 1-click US patterns (ZIP codes, phone numbers, emails, dates).

US Pattern Presets:
/
/g
2 matches found Engine: Browser JavaScript RegExp (100% Local)
#1 help@findteck.com (index 9)
Groups: $1: help $2: findteck.com
#2 sales@example.org (index 34)
Groups: $1: sales $2: example.org

Quick Regex Cheat Sheet

  • \d digit (0โ€“9) โ€ข \w word char (Aโ€“Z, 0โ€“9, _) โ€ข \s whitespace
  • ^ start of line โ€ข $ end of line โ€ข \b word boundary
  • + 1 or more โ€ข * 0 or more โ€ข ? optional โ€ข {n,m} exact count range
  • (...) capture group โ€ข (?:...) non-capturing group
Tool Documentation & Guide

Testing, Highlighting & Debugging Regular Expressions Live

Regular expressions (Regex) power form validation, log parsing, search-and-replace refactors, and routing rulesโ€”yet one misplaced quantifier or greedy wildcard can silently fail or cause catastrophic backtracking. Testing patterns live against real multi-line samples verifies every capture group before shipping code.

Step-by-Step Instructions

  1. Enter your JavaScript regular expression pattern and toggle flags (g global, i case-insensitive, m multiline).
  2. Paste realistic test stringsโ€”including both valid inputs that MUST match and edge-case inputs that MUST fail.
  3. Inspect highlighted matches, total match count, and numbered capture groups in real time.
  4. Fix invalid syntax immediately using the live inline RegExp error message.

Worked Example & Methodology

Testing ^\d{5}(-\d{4})?$ with the multiline flag (m) cleanly matches US ZIP codes like "94107" and "10001-1234" while rejecting malformed entries like "9410" or "ABCDE".

Privacy & Verification: All pattern matching executes locally inside your browser JavaScript engineโ€”production logs and customer records never leave your machine.

Frequently Asked Questions

What is the difference between greedy (.*) and lazy (.*?) quantifiers?

Greedy .* grabs as many characters as possible up to the final delimiter on a line; adding ? (.*?) stops at the very first matching delimiter.

Why do anchors ^ and $ behave differently with the m flag?

Without m, ^ and $ match only the start and end of the entire string. With multiline (m), they match the start and end of every individual line.

Why should I watch out for nested quantifiers like (a+)+?

Nested ambiguous quantifiers can trigger exponential backtracking (ReDoS) on long non-matching inputs. Always keep character classes specific and non-overlapping.

Is JavaScript regex syntax compatible with Python and PCRE?

Core syntax (\d, \w, +, *, ?, [], (), lookaheads) is identical across JS, Python, Go, and C#; only niche features like inline flag modifiers differ slightly.