Developer

Live Regular Expression (Regex) Tester & Capture Group Inspector

Test JavaScript regular expressions in real time with match highlighting, capture group breakdown, replace preview, and quick-reference syntax cheat sheet.

# Match Index Capture Groups
Developer Cloud VPS

DigitalOcean

Simple, predictable cloud droplets and managed Postgres databases.

View Cloud Plans →

How It Works & Methodology

Compiles your pattern using the native JS RegExp engine with selectable flags (g, i, m, s, u) and safely guards against zero-length infinite loops.

Displays color-highlighted inline matches, an indexed table of match positions and capture groups ($1, $2...), plus optional live Replace output.

Practical Example

Use ^([a-zA-Z0-9._%-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$ with multiline flag (m) to capture usernames ($1) and domains ($2) from email lists.

Frequently Asked Questions

Which regex engine flavor is used?

Standard ECMAScript / JavaScript RegExp (ES2018+), compatible with browser JS, Node.js, and TypeScript.

Why does the g (global) flag matter?

With g enabled, all matches in the text are highlighted and listed; without g, matching stops at the first hit.

Can I preview find-and-replace with capture groups?

Yes, enter a replacement template (such as $1-$2) in the Replace box to verify output in real time.

Are common patterns included?

Yes, one-click presets cover Email, URL, IPv4, SemVer, Date YYYY-MM-DD, Hex Color, and Slug.

Related Tools