Substituição Regex

Busque e substitua texto com padrões regex em tempo real. Suporta $1, $2.

Regex Pattern
Replace With
Test Text
Match Preview
Matches will appear here...
0 characters 0 matches

Regex Replace

This regex find-and-replace tool lets you search for patterns and replace them with new text in real time. All six JavaScript regex flags are supported, and the replacement string understands backreferences like $1, $2, so you can rearrange captured groups. Matches are highlighted before you commit the replacement.

The search and replace runs locally in your browser. The text you enter is not uploaded, stored, or sent to a server, so you can transform content privately and quickly.

How to use

  1. Type or paste a regex pattern into the Regex Pattern field. No delimiters needed.
  2. Select the flags you need: g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), or y (sticky).
  3. Enter a replacement string in the Replace With field. Use $1, $2 for backreferences to captured groups.
  4. Paste or type your test text into the editor below. Matches are highlighted as you type.
  5. Click Replace All to apply the replacement to the entire text.
  6. Use Copy to copy the result, Download to save it, or Clear to reset everything.

What are regular expressions?

A regular expression (regex) is a sequence of characters that defines a search pattern. It is used for pattern matching within strings, such as finding specific words, validating formats like emails or phone numbers, or splitting text by complex delimiters.

JavaScript implements regex natively via the RegExp object. The same syntax works in most programming languages with minor variations. Regex find-and-replace is one of the most powerful text transformation techniques available to developers.

Input notes

Enter the regex pattern without delimiters. The flags are controlled by the checkboxes. The replacement string supports standard backreferences: $1 through $9 for captured groups, and $& for the entire match.

Example

Reformatting dates from MM/DD/YYYY to YYYY-MM-DD using backreferences:

--- Pattern ---
(\d{2})/(\d{2})/(\d{4})

--- Replacement ---
$3-$1-$2

--- Flags ---
g (global)

--- Test Text ---
Today is 04/29/2026 and tomorrow is 04/30/2026.

--- Result ---
Today is 2026-04-29 and tomorrow is 2026-04-30.