Regex Replace Tool

Find and replace with regular expressions and capture groups.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

A focused regex find-and-replace tool: enter a pattern, a replacement string, pick your flags, and watch the substituted output update live. Capture-group references let you reorder and reshape matched text — ideal for reformatting dates, cleaning data, bulk-editing code, and one-off text transformations.

How it works

The tool builds a JavaScript RegExp from your pattern and the flags you select, then runs String.replace against your input. In the replacement string you can use the standard substitution tokens: $1, $2 for the first, second numbered capture group, $& for the whole match, $<name> for a named group, and $$ for a literal dollar sign. The flags control matching: g (global) replaces every match instead of just the first, i ignores case, m (multiline) makes ^ and $ match at line breaks, and s (dotall) lets . match newlines. A live match count confirms how many replacements were applied.

Example

Reformat ISO dates to day/month/year. With the global flag on:

  • Find: (\d{4})-(\d{2})-(\d{2})
  • Replace: $3/$2/$1
  • Input: 2026-05-28
  • Output: 28/05/2026
TokenMeaning
$1, $2Numbered capture groups
$&Entire match
$<name>Named capture group
$$Literal $

Patterns use the standard JavaScript engine, so what works here works in your code. Nothing is uploaded; all matching happens in your browser.

Ad placeholder (rectangle)