Regex Tester & Pattern Explainer

Test regular expressions in real time with syntax match highlighting, capture group extraction, and plain English token breakdowns.

Common Patterns:
Valid Regex
/ / gi
Flags:
2 matches found

Live Match Highlighting

Extracted Matches & Capture Groups

# Full Match Index Length Groups

Pattern Anatomy & Token Explanation

About this tool

How to use it

  1. Enter or paste your regular expression pattern between the slashes in the pattern input bar.
  2. Toggle standard regex flags: g (global search), i (case insensitive), m (multiline), s (dotAll), or u (unicode).
  3. Type or paste your target text into the Test String input box to see matches highlighted in real time.
  4. Inspect the capture groups table and review the plain English token breakdown to understand how each token behaves.

Why it matters

Regular expressions are notoriously compact and error-prone. A single unescaped dot ('.') or missing anchor ('^', '$') can cause catastrophic data truncation or security bypasses. Live visual testing with instant token explanation prevents regex bugs before deploying code.

When to use it

Use this tool when debugging form validation rules in JavaScript/TypeScript, authoring Python data extraction scripts, constructing Web Application Firewall (WAF) filters, or parsing server access logs.

Good to know

JavaScript regular expressions run directly in the V8 engine within your browser. No strings or test data are transmitted to external servers, protecting sensitive log files and proprietary payloads.

Common questions

What is the difference between global (g) and non-global regex?

Without the 'g' flag, a regular expression stops searching after finding the first match. With the 'g' flag enabled, it searches the entire test string, returning every match found.

What do capture groups (...) do?

Parentheses create capturing groups that extract specific sub-strings from a match. For example, in an ISO date pattern like (\d{4})-(\d{2})-(\d{2}), group $1 captures the year, $2 the month, and $3 the day.

Why is the dot '.' character special in regex?

A raw dot matches any character except line terminators. To match a literal period (such as in a domain or IP address), you must escape it with a backslash: '\.'.

Can I export match results as JSON?

Yes. Click 'Copy Matches (JSON)' to copy an array of all matched strings, starting string indices, lengths, and captured group values formatted as clean JSON.