Regex
Test JavaScript regular expressions against text and inspect matches live.
Order #1042 — alice@example.com — 2026-05-18 Order #1043 — bob@example.org — 2026-05-19 Order #1044 — carol@example.net — 2026-05-20
| # | Index | Match | Groups |
|---|---|---|---|
| 1 | 14 | alice@example.com | alice · example.com |
| 2 | 59 | bob@example.org | bob · example.org |
| 3 | 102 | carol@example.net | carol · example.net |
Order #1042 — <alice@example.com> — 2026-05-18 Order #1043 — <bob@example.org> — 2026-05-19 Order #1044 — <carol@example.net> — 2026-05-20
Notes
- Uses the browser's
RegExp— JavaScript flavor. - Flags:
g,i,m,s,u,y. - Replacement supports
$1,$2, … backreferences.
Test regular expressions live
Regular expressions are a notation for matching patterns in text. This tool runs your pattern as a JavaScript RegExp against the sample text and highlights every match, updating live as you type. JavaScript's regex flavour is what runs in browsers and in Node, so a pattern that works here will work in your front-end and most of your back-end too.
Flags reference
g— global, find all matches instead of stopping after the first.i— case-insensitive.m— multiline, makes^and$match line breaks inside the input instead of only the very start and end.s— single-line, makes.also match newline characters.u— Unicode mode, required for full support of code-point escapes like\p{Letter}.y— sticky, anchors each match atlastIndex.
Patterns that come up a lot
- Email-ish addresses —
[^@\s]+@[^@\s]+\.[^@\s]+is enough for 99% of cases; a fully RFC-compliant pattern is hundreds of characters long and rarely worth it. - UUIDs —
[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}with theiflag. - ISO dates —
\d{4}-\d{2}-\d{2}for date-only,\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}for datetimes.
Performance
Most regexes execute in microseconds, but pathological patterns — repeated alternations like (a|a)*b against long strings — can exhibit catastrophic backtracking and hang the page. If a match feels slow, simplify the pattern or anchor it; a few extra characters of specificity often turn an exponential search into a linear one.