Regex

Test JavaScript regular expressions against text and inspect matches live.

//
3 matches
Test input
Highlighted
Order #1042 — [email protected] — 2026-05-18
Order #1043 — [email protected] — 2026-05-19
Order #1044 — [email protected] — 2026-05-20
Matches (3)
#IndexMatchGroups
114[email protected]alice · example.com
259[email protected]bob · example.org
3102[email protected]carol · example.net
Replace
Order #1042 — <[email protected]> — 2026-05-18
Order #1043 — <[email protected]> — 2026-05-19
Order #1044 — <[email protected]> — 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 at lastIndex.

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 the i flag.
  • 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.