DevDock
All toolsDeveloper

Regex Tester

Write a pattern, paste sample text, see matches and groups — then preview replace and copy the finished expression.

JavaScript regex in your browser — matches, groups, and replace. Nothing leaves this tab.

Keep g on when you want every match, not only the first.

Highlighted

2 matches · <1 ms

Reach [email protected] or [email protected] today.
Invalid: not-an-email, also user@localhost

Use $1 / $& / $<name> — same as String.replace

Matches(2 matches)

  • $1hello6–11
  • $2devdock.com12–23
  • $1support27–34
  • $2example.org35–46

Copy for code

Literal
/(\w+)@([\w.-]+\.\w+)/gd
new RegExp
new RegExp("(\\w+)@([\\w.-]+\\.\\w+)", "gd")

How to use this tool

  1. Enter a JavaScript pattern between the slashes and toggle flags (g i m s u d).
  2. Paste a test string. Matches highlight live; each hit lists capture groups and offsets below.
  3. Use Replace with $1 / $& as needed, then copy /pattern/flags or new RegExp(…) into your code.

A private JS regex workbench — not a classroom

Most day-to-day regex work is the same loop: try a pattern against real sample text, inspect groups, tweak replace, paste into code. This tool stays on that loop. It uses your browser's engine so behavior matches production JavaScript — including named groups, lookarounds, and Unicode mode when you enable u.

Need to compare two blobs of text instead? Try the Text Diff. Renaming identifiers across styles? Use the Case Converter.

FAQ

Which regex flavor is this?

JavaScript / ECMAScript — the same engine your browser uses for RegExp, String.match, and String.replace. Patterns that pass here behave like they will in Node and front-end code. It is not PCRE, Python, or Go RE2.

Why do I need the g flag?

Without g, JavaScript returns only the first match (and replace updates only the first occurrence). Turn g on to find and replace every match — the usual choice when testing.

What do $1 and $<name> mean in Replace?

$1, $2, … insert numbered capture groups. $& is the whole match. $<name> inserts a named group like (?<name>…). This mirrors String.prototype.replace in JavaScript.

Is my text or pattern uploaded?

No. Matching and replace run entirely in your browser. Nothing is sent to a server.

Why did matching stop at thousands of hits?

Very broad patterns can produce huge result sets. The tool caps listed matches so the page stays responsive — tighten the pattern or sample text to inspect the rest.