PlayTools

Find and Replace Text

Find and replace across a block of text — plain or regular-expression search, case-insensitive matching, and $1 group references in regex mode. Shows the match count.

Runs in your browser — nothing you enter is uploaded

Enter something to find.

Plain mode treats the search text literally — no special characters — and a $ in the replacement stays a $. Regex mode uses JavaScript regular expressions with the global flag always on; in the replacement, $1, $2 … insert captured groups and $& inserts the whole match. Replacement is all-or-nothing: every match is changed. Runs entirely in your browser.

Advertisement

Bulk find and replace, plain text or regex

A find-and-replace runs over an entire block of text at once and changes every match. This tool has two modes. Plain mode treats your search term literally: dots, asterisks, brackets and backslashes are all matched as themselves, and a dollar sign in the replacement stays a dollar sign. It is the safe choice when you just want to swap one exact string for another.

Regex mode interprets the search box as a JavaScript regular expression. That unlocks patterns — word boundaries (\b), character classes ([A-Z]), quantifiers (+, *, ?), alternation (cat|dog) — and, crucially, capture groups. Wrap part of the pattern in parentheses and you can refer back to it in the replacement with $1, $2 and so on; $& inserts the whole match and $$ a literal dollar. Reformatting "Last, First" into "First Last" is one line: find ^(\w+),\s*(\w+)$, replace with $2 $1.

The flags fine-tune matching. The global flag is always on, so every occurrence is replaced. Case-insensitive (i) ignores letter case. Multiline (m) makes ^ and $ match at each line break instead of only the ends of the text. DotAll (s) lets the . metacharacter match newline characters, so a pattern can span lines. The last two apply only in regex mode.

The result and the match count update as you type, and an invalid regular expression shows the exact JavaScript error rather than silently doing nothing. Common uses: renaming a variable across a file, converting delimiters, stripping tracking parameters from a list of URLs, normalising whitespace, or reshaping exported data before importing it somewhere else.

All matching and replacement happens in your browser with the built-in RegExp engine. Nothing you paste is uploaded.

Key formulas (reference)

plain:  text.split(find).join(replace)          // find is literal, $ stays $
regex:  text.replace(new RegExp(find, "g" + flags), replace)
  $1 $2 … = capture groups   $& = whole match   $$ = literal $

These free tools pair well with this page — open them in a new tab to finish your workflow.

Advertisement

Frequently Asked Questions

What is the difference between plain and regex mode?

Plain mode searches for your text literally — every character, including . * ? and \, is matched as-is, and a $ in the replacement stays a $. Regex mode interprets the search box as a JavaScript regular expression and enables group references in the replacement.

Does it replace all matches or just the first?

All of them. The global flag is always on, so every match in the text is replaced in one pass. There is no "replace next" stepping.

How do I use captured groups in the replacement?

In regex mode, write ( ) around the part of the pattern you want to capture, then use $1, $2, … in the replacement to insert them. $& inserts the entire match, and $$ inserts a literal dollar sign. Example: find (\w+)@(\w+), replace with $2.$1.

What do the m and s flags do?

With m (multiline), ^ and $ match at the start and end of each line rather than the whole text. With s (dotAll), the . metacharacter also matches newline characters. Both only apply in regex mode.

Why does my regex show "invalid regular expression"?

The pattern has a syntax error — often an unbalanced bracket or parenthesis, or a stray backslash. The exact JavaScript error message is shown; fix the pattern and the result updates live.

Can it search across multiple lines at once?

Yes. The whole text is treated as one string, so a regex like foo\n\s*bar matches across a line break. Enable the s flag if you need . to span newlines too.

Is my text sent anywhere?

No. Matching and replacement run entirely in your browser using the built-in RegExp engine. Nothing is uploaded.