Regex Matcher & Replacer

Test regular expressions with live match highlighting and replace using backreferences. Free online regex tester and replacer — runs in your browser.

Pattern explanation (basic)
  • \bWord boundary
  • \wWord character (letter, digit, underscore)
  • .Any character (except newline unless dotall /s)
  • +One or more
Current flags: gi
What do these flags do?
  • gGlobal: Find all matches (not just the first).
  • iIgnore case: Case-insensitive matching.
  • mMultiline: ^ and $ match start/end of each line.
  • sDotall: . matches newlines too.
  • uUnicode: Enable full Unicode matching semantics.

Input Text

Size: 0.1 KB

Match Preview

Total matches: 0
No matches found
The email is john@example.com His work is jane@work.org Contact: support@txtutils.net

Captured Groups (active match)

Replacement

Available backreferences
  • $& — entire match
  • $` — text before match
  • $' — text after match
  • $1, $2, ... — capture groups
  • $<name> — named group (if present)
  • $$ — literal $

Output

Replaced count (preview): 0

About the Regex Matcher & Replacer

This free online regex tester lets you build and debug JavaScript (ECMAScript) regular expressions with live match highlighting, capture-group coloring, and a replacement preview. Toggle flags, paste a /pattern/gi literal, and watch matches update as you type — then apply replacements with full backreference support.

Everything runs entirely in your browser. Your text and patterns are never uploaded to a server, so you can safely test on private or sensitive data.

Common use cases

  • Extract or redact emails, URLs, phone numbers, and IDs from a block of text.
  • Bulk find-and-replace with capture groups, e.g. reformat dates or names.
  • Validate that a pattern matches the strings you expect before shipping it in code.
  • Learn regex by experimenting with flags and reading the live token explanation.

How it works

  1. Type a regex pattern and toggle the flags you need (g, i, m, s, u).
  2. Paste your text — matches highlight instantly, with capture groups color-coded.
  3. Enter a replacement string using $1, $&, or $<name> backreferences.
  4. Click Replace All or Replace One, then copy or download the result.

Frequently asked questions

What regex flavor does this use?

It uses JavaScript (ECMAScript) regular expressions, including flags like g, i, m, s, and u.

Can I use capture groups in replacements?

Yes. Use $1, $2, … or named groups $<name> in the replacement field to reference captured text.

Is my text sent anywhere?

No. Matching and replacing run entirely in your browser; nothing is uploaded to a server.

Why is my pattern not matching?

Check that the correct flags are set (e.g. g for all matches, i for case-insensitive) and that special characters are escaped.