Regular Expression Tester
yesvalid0matchesyesglobal

Pattern

//

Uses the browser native RegExp engine, so results match exactly what your JavaScript will do.

Test text

Matches

0 found

No matches in the current text.

Regular Expression Tester

Build and test regular expressions in your browser with instant feedback. See every match with position and capture groups, toggle flags, and try ready-made patterns for emails, UUIDs, dates and more.

About this tool

What is it?
DataFormatter Regex Tester is a free online tool that tests regular expressions with the browser's own engine, showing instant validity, every match with positions and capture groups, plus a per-line mode.
Who is it for?
Developers writing or debugging regex for validation, parsing and log auditing without running a script.
What makes DataFormatter's tool different?
It runs 100% client-side against your browser's native engine, so behavior matches real JavaScript exactly.

Quick start

  1. Type a pattern between the slashes — or click a demo (Email, UUID, ISO date…).
  2. Toggle flags with the chips; the /g global flag changes the match count semantics.
  3. Paste your own sample text and watch matches highlight with position and groups.
  4. Switch to Per line when auditing config or log files line-by-line.

What the playground shows

  • Instant validity — a red error explains exactly what the engine rejected and why.
  • Each match with its index, the matched text, and up to 6 capture groups.
  • Named groups displayed as name=value pairs ready to reference in replacement code.
  • A context preview showing the characters before and after each match.
  • Per-line mode with match counts per input line for log and config auditing.

Who tests regex online — and when

Writing validators

Draft an email or UUID pattern, flip i/g as needed, and verify the capture group before it lands in a validation rule.

Auditing logs

Build a pattern, switch to Per line, and confirm it isolates exactly the lines you want before wiring it into your log scanner.

Learning by demo

Five ready patterns show ranges, repetition, groups and character classes working against the same sample data you can edit.

When matches surprise you

Only one match despite text containing several

Why: The pattern lacks the g flag, so a non-global RegExp stops after the first match.

Fix: Toggle the g chip on and the count jumps to every occurrence.

^ and $ don't match per line

Why: Those anchors bind to string start/end unless m (multiline) is set.

Fix: Add m, or switch to Per line mode which anchors each line for you.

Invalid escape

Why: Patterns like \d\s written with single backslashes inside a string sometimes become doubled literals in JavaScript source.

Fix: In code, write String.raw`\d+` or double the backslashes; here, paste the pattern as the engine sees it.

Pro tips

  • Copy Matches gives you a versioned record — pattern, flags, match count and every group — ready for a ticket or PR description.
  • Named groups show their keys, so you can confirm (?<year>\d{4}) captures the field you intend.
  • Browser-parity means code you write here behaves identically in Node's regexp engine.

Frequently asked questions

How accurate is the testing?

It runs the browser's native RegExp engine on your exact pattern, flags and text. What you see here is precisely what JavaScript (Node or in-browser) will do — no interpreter mismatch.

What does Whole text vs Per line mean?

Whole text matches against the entire block, honoring the m (multiline) and s (dotAll) flags exactly like RegExp.text.test(). Per line splits input into lines first and reports per-line match counts — handy for checking log files line-by-line where ^ and $ should anchor each line regardless of the m flag.

Which flags are supported?

d (indices), g (global), i (ignore case), m (multiline), s (dotAll), u (unicode), v (unicodeSets, in modern engines) and y (sticky). Toggle them as chips; the engine validates them the way the browser would.

Why does my non-global pattern show limited matches?

Without g (or y), a RegExp only finds the first match by design. The tool tells you the pattern is non-global and scans as if global for display purposes — but the global badge makes the semantic clear.

Can it show capture groups?

Yes. Each match lists its positional groups and named groups (like (?<name>…)), so you can verify what would actually be captured in your code before you write it.

Is anything uploaded?

No. Everything runs locally, so it's safe to test patterns against real config or log samples that contain sensitive data.

Related tools

Last reviewed September 2026 · DataFormatter team — this tool processes data locally in your browser.