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 |
|---|
DigitalOcean
Simple, predictable cloud droplets and managed Postgres databases.
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
JSON Formatter & CSV/YAML
Pretty-print, minify, validate, sort keys, and convert JSON to YAML or CSV (and CSV back to JSON) offline inside your browser.
DeveloperCron Expression Parser
Build, validate, and translate standard 5-field Linux/Docker cron expressions into plain English and preview the next 10 execution times in Local and UTC time.
DeveloperJWT / Hash / Base64
Decode JWT headers and claims offline, compute SHA-256/SHA-512 & HMAC-SHA256 digests via Web Crypto API, encode/decode Base64 & URLs, and generate UUID v4.