Multi-Tool Workspace

Regex Replace / Extract — Online Regex Tool

Run RegExp replace or extract with flags, capture groups, and match limits. 100% client-side.

About this tool

Replace or extract text using JavaScript RegExp with full control over flags, capture groups, and tokens.

Safeguards for large inputs: byte caps, match limits, timeouts.

Everything runs in your browser.

FAQ

  • Does this upload my text?

    No. Everything runs locally in your browser.

  • Which flags are supported?

    Any JS RegExp flags: g, i, m, u, y, s. If empty, this tool defaults to g.

  • What replacement tokens can I use?

    Use $$, $&, $`, $', and $1…$9 (capture groups).

  • Can I share a prefilled link?

    Yes—your text and options are encoded in the URL (?q=...&pattern=...&mode=...).

The quick BROWN (matched) fox.
BROWN (matched)!

How to use

  1. Enter a pattern (no /slashes/) and optional flags (e.g. gi).
  2. Choose Replace (with a replacement template) or Extract (optionally set a capture Group).
  3. Paste your input text, then click Run or press ⌘/Ctrl+Enter for Replace.
  4. Use Copy to copy results, or Share to copy a prefilled link.

Common pitfalls

  • Invalid pattern: you’ll see an error from RegExp construction.
  • Missing g flag: Extract/Replace without g only processes the first match.
  • Zero-length matches: the engine forces progress to prevent infinite loops.
  • Replacement syntax: supports $$, $&, $`, $', $1…$9.
  • Timeouts/huge inputs: long runs can time out; inputs are byte-truncated safely.

Example

Replace
Pattern: brown • Flags: gi • Replacement: red
Brown BROWN brown
red red red
Extract
Pattern: [\w.+-]+@[\w.-]+\.[A-Za-z]{2,} • Flags: g
a@x.io, b@example.org
a@x.io
b@example.org