Regex Replace

Replace regex matches using $1, $<name> and $& and see how many replacements were made. Time-limited.

Options

Input

Ctrl + Enter to run

Result

Find and replace with regular expressions using JavaScript replacement syntax: $1…$99 for numbered groups, $<name> for named groups, $& for the whole match and $$ for a literal dollar.

It shows how many replacements were made and applies the same 1-second time limit as the tester.

How to use it

  1. Type the pattern and tick the flags (g to replace all).
  2. Paste the text.
  3. Type the replacement and press Run.

Example

Example input
(\d{4})-(\d{2})-(\d{2})

Inicio 2025-01-15, fin 2025-02-03.

$3/$2/$1
Result
Inicio 15/01/2025, fin 03/02/2025.

Limitations

  • The replacement is a text template: functions or code are not supported.
  • Without the g flag only the first match is replaced.

FAQ

How do I change a date format?
With the pattern (\d{4})-(\d{2})-(\d{2}) and replacement $3/$2/$1, 2025-01-15 becomes 15/01/2025.
How do I write a literal $?
Use $$.

Related tools

References