Developer Tool

Regex Tester — Live Match Highlighter

Test regular expressions with live match highlighting, capture group inspection, and match list. Supports all JavaScript regex flags: global, case-insensitive, multiline, and dotAll. Quick-reference chips for common patterns. Runs entirely in your browser.

Live highlighting Runs in browser Capture groups Quick reference
/ /

Test Text

Highlighted Matches

Replace

Quick Reference — click to insert

Pro — save patterns library, regex explainer, named groups, PCRE mode, API access

API access · Priority queue · Team workspace

Upgrade — $19/mo

How It Works

STEP 1

Enter Pattern & Text

Type your regex pattern in the orange input field and paste the test text in the left textarea. Use the quick reference chips to insert common patterns (email, URL, date, IP, etc.) directly into the pattern field. Toggle flags: g (global — find all matches), i (case-insensitive), m (multiline — ^ and $ match line boundaries), and s (dotAll — dot matches newlines).

STEP 2

See Live Matches

The right panel shows the test text with all regex matches highlighted in orange. The match count updates in real time. Scroll down to see the Matches list — each match is shown with its full string, start index, and any capture groups. If your pattern has an error, a red error box explains the issue. The match list shows each match on its own line with group values for patterns containing parentheses.

STEP 3

Test Replacement

Enter a replacement string in the Replace field and click Replace All to preview the result of applying the regex with the replacement to the entire test text. Use $1, $2 etc. to reference capture groups in the replacement. The replace output appears below the field — copy it with the Copy Result button. Useful for constructing and testing sed-style substitution patterns.

Regex Tester Features

Live Match Highlighting

Matches are highlighted in the output panel as you type with alternating orange and amber colors for consecutive matches — making it easy to see all matches even when they appear adjacent to each other. The highlighted view preserves newlines and whitespace identically to the input, so the visual layout matches your source text. The match counter shows the number of matches found instantly.

Capture Group Inspection

When your pattern contains capturing groups (parentheses), the match list shows the full match and each captured group for every match. For example, the pattern (\w+)@(\w+) on an email address shows both the username capture and the domain capture. Named captures ((?<name>\w+)) are also supported and displayed with their group names in the match list.

Replace with Groups

Test replacement patterns using capture group references. Enter a replacement in the Replace field using $1, $2 for numbered groups or $<name> for named groups. Click Replace All to preview the substitution result. Useful for testing sed patterns, JavaScript String.replace() logic, and Python re.sub() replacements before running them in production code.

Quick Reference Chips

12 quick-reference chips for common regex patterns — click any chip to insert its pattern into the regex field: \d+ (digits), \w+ (word characters), email address, URL, YYYY-MM-DD date, hex color code (#RGB or #RRGGBB), IPv4 address, hashtag, and more. Each chip shows the pattern and a brief description, letting you learn and build patterns without memorizing syntax.

All Regex Flags

Toggle all four JavaScript regex flags independently: g (global — find all matches, not just the first), i (case-insensitive — A matches a), m (multiline — ^ and $ match line starts and ends instead of string start/end), and s (dotAll — . matches newline characters in addition to all other characters). Active flags are highlighted in orange.

Error Reporting

When your regex has a syntax error (unclosed bracket, invalid escape, etc.), a red error banner shows the exact error message from the JavaScript regex engine. The highlight panel clears and the match count resets to 0. Common errors: Unterminated group (unclosed parenthesis), Invalid escape (unknown backslash sequence), Range out of order (e.g., [z-a] in a character class).

Free vs Pro

FeatureFreePro
Live highlighting + capture groups
Replace with group references
Save pattern library
Regex explainer (plain English)
PCRE / Python re mode
REST API access

Frequently Asked Questions

This tool uses JavaScript's built-in RegExp engine, which implements a subset of PCRE (Perl Compatible Regular Expressions). It supports character classes, quantifiers, anchors, lookahead/lookbehind assertions, named capture groups, and all four flags (g, i, m, s). It does not support PCRE-specific features like possessive quantifiers (++), atomic groups (?>), or branch reset groups. For Python re or Java Pattern syntax testing, upgrade to Pro.

The m (multiline) flag changes how ^ and $ work: without m, they match the start and end of the entire string; with m, they match the start and end of each line (newline boundary). The s (dotAll) flag changes how . works: without s, dot matches any character except newline; with s, dot matches any character including newline. Use m when matching line-by-line patterns; use s when your match needs to span multiple lines.

Capture groups are parenthesized sub-expressions that extract parts of a match. The pattern (\d{4})-(\d{2})-(\d{2}) matches a date and captures the year in group 1, month in group 2, and day in group 3. In the match list, you will see [full match, group1, group2, group3]. In the replacement field, reference them as $1, $2, $3 — e.g., replacing with $3/$2/$1 converts YYYY-MM-DD to DD/MM/YYYY.

Lookahead (?=...) matches a position followed by the given pattern without including it in the match. \w+(?=\s+is) matches words followed by " is" without including " is" in the match. Negative lookahead (?!...) matches positions NOT followed by a pattern. Lookbehind (?<=...) matches positions preceded by a pattern. These are zero-width assertions — they test the surrounding context but do not consume characters.

Quantifiers (*, +, ?, {n,m}) are greedy by default — they match as much as possible. The pattern <.+> on <b>text</b> matches the entire <b>text</b>, not just <b>, because . matches any character including >. Make a quantifier lazy (non-greedy) by adding ? after it: <.+?> matches the shortest possible string, finding <b> and </b> separately.

Yes — all regex matching runs in your browser using the native JavaScript RegExp engine. No text or patterns are transmitted to any server. Safe for testing regex against sensitive log files, PII data, confidential documents, and internal content that must not be sent to external services. Disconnect from the internet and the tester still works — confirming there is no server dependency.