Find and replace text

Paste your text, write a rule, and the result updates with every keystroke. Nothing leaves your browser.

Rules
Try an example:
Original
Result
0 replacements0 to 0 characters, 0 lines

What a find and replace tool actually does

You hand it a block of text and a rule. It scans the text for everything that fits the rule and swaps each hit for something new, in one pass. Renaming a variable across a file, cleaning pasted web copy, fixing a product name that was spelled three ways: it is the same move every time.

This version is built for quick bulk edits online. No account, no upload, no editor to open. The result is ready the moment you stop typing.

Your text
<p class="lead">Hi</p>
Your rule
class=becomesclassName=
The result
<p className="lead">Hi</p>

Four switches, four different jobs

Each specimen below runs the same search with the switch off, then on. Green is what gets changed.

Match case
Off, capitals are ignored. On, the letters must match exactly, which is what you want for names and code.
Searching for apple
OffApple, apple, APPLE
OnApple, apple, APPLE
Whole word
Stops a short search from biting chunks out of longer words. The cheapest insurance against silly mistakes.
Searching for cat
Offcat, category, concat
Oncat, category, concat
Regex
Describes a shape instead of a spelling: any digits, any run of spaces, anything between two brackets.
Searching for \d+
OffOrder 4821 left on 2027-01-07
OnOrder 4821 left on 2027-01-07
First only
Changes the opening hit and leaves the rest alone. Handy for titles, headers and one-off edits.
Searching for red
Offred, red, red
Onred, red, red

Regular expressions without the headache

Regex looks scary mostly because of the punctuation. Underneath, it is a short list of building blocks, plus one trick that is worth learning properly: groups.

Groups let you rearrange

Brackets in the search remember what they caught. In the replacement, $1 recalls the first catch and $2 the second, in any order you like.

Search(\w+) (\w+)Replace$2, $1TextGrace HopperResultHopper, Grace
\d+a run of digits
\w+a run of letters, digits or underscores
[ ]{2,}two or more spaces in a row
^ and $the start and the end of each line
.*?as little of anything as possible
[^>]+anything except a closing angle bracket
(red|blue)either word, remembered as a group
\bthe edge of a word
In the replace field
$1 $2whatever group 1 or 2 caught
$&the whole match
\na line break
\ta tab

Recipes worth keeping close

Press Try it and the rule, the switches and a sample text load straight into the tool above.

JobFindReplace withSwitches
Port HTML attributes to JSXclass="className="none
Swap non-breaking space entities for real spaces&nbsp;one spacenone
Collapse runs of spaces into one[ ]{2,}one space
Regex
Reorder words with capture groups^(\w+) (\w+)$$2, $1
Regex
Remove every HTML tag<[^>]+>nothing
Regex
Turn a comma list into one item per line,\s*\n
Regex
Rewrite 2027-01-07 as 07/01/2027(\d{4})-(\d{2})-(\d{2})$3/$2/$1
Regex
Rename one variable without touching its cousinstotalsum
Match caseWhole word

Three ways a replacement goes sideways

Almost every bad bulk edit is one of these. Each has a quick fix.

The word inside a word
Swapping cat for dog without Whole word.
The cat in the categoryThe dog in the dogegory
Switch on Whole word.
Rules that trip over each other
Rules run top to bottom, and each one sees the output of the one before.
red, bluered to blueblue, blueblue to greengreen, green
Put the rule that must not cascade last, or use a temporary placeholder.
The greedy pattern
<.+> grabs as much as it can, not as little as it needs.
<b>bold</b> and <i>it</i><b>bold</b> and <i>it</i>
Use <[^>]+> to stop at the first closing bracket.

Habits that save you from redoing it

  • Read the highlight before you copy anything. The green marks sit right on your text, so you can see what a rule will touch.
  • Start with plain text. Reach for Regex when you catch yourself typing the same thing with small variations.
  • Give each rule one job. Three short rules are easier to debug than one monster pattern.
  • Use “Use as input” to build on a result. Undo is one click away if you overshoot.
  • Try the rule on a few lines first, then paste the full document.

Questions people ask

Is my text sent to a server?

No. Matching and replacing happen inside your browser tab, and closing the tab clears everything.

How do I replace something with a line break?

Switch on Regex, then type \n in the replace field. Use \t if you need a tab.

What does the red “Invalid pattern” message mean?

The regular expression is incomplete, usually an unclosed bracket or a stray parenthesis. The message under the field says which.

Does Whole word work with accented letters?

In plain mode, yes: ă, â, ș and friends count as letters. In Regex mode the word edge follows JavaScript’s rule and only knows A to Z, so prefer plain mode for accented text.

How is this different from Ctrl+H in my editor?

It works on pasted text without opening a file, chains several rules in order, and shows the hits live before you commit to anything.