Text
Find & Replace
Replace every match in a block of text. Use plain text or a regular expression, and optionally ignore case. The replacement is inserted literally.
Result
—
Output actions
Ready to copy output once your result appears.
Replace every match, literally
Find & Replace rewrites Text by swapping every match of Find for the Replace with text. Plain text is the default, so a period matches a period. Regex mode compiles Find as a JavaScript pattern with the global flag always on. Case-insensitive adds the i flag. The replacement is inserted as typed. $1 is not a backreference. There is no multiline switch.
How to replace matches
- 1Paste into Text. Type the search in Find and the new text in Replace with. Leave Replace with empty when the match should be deleted.
- 2Turn on Regex mode only when Find is a pattern. Turn on Case-insensitive when Hello and hello should both match. Both boxes start off.
- 3Press Replace all. The line under the button counts the matches. Result holds the rewritten text. Copy output copies Result, not the count. An empty Find says Enter a find pattern. and clears Result.
What it is good for
- • Swapping a repeated word such as draft for final on every line.
- • Deleting a character by replacing it with an empty Replace with box.
- • Applying a digit pattern when you want NUM in place of each run, without expanding $1.
Example
Input
draft title draft description
Output
final title final description
Find is draft, Replace with is final, and both checkboxes are off. The count line reads 2 matches replaced. A second line that starts with Draft is not changed unless Case-insensitive is on.
What Replace all changes
The button is Replace all because the search flag is always g. There is no control that stops after the first hit. Plain mode escapes the metacharacters in Find before compiling, so a.b matches the three characters a, dot, b, and does not match aXb. In the text a.b aXb, plain mode with Find a.b and replacement Z produces Z aXb and the count 1 match replaced. The same Find in Regex mode produces Z Z and 2 matches replaced, because the dot matches any character except a newline.
The replacement is returned from a function, so the engine does not scan it for $&, $1, or $$. Regex mode with Find (hello) and Replace with $1! against hello yields the four characters $1!, and the count is 1 match replaced. If you needed the captured text, read the groups on the regex tester first. That page lists indexes and captures. It does not rewrite the subject. This page will not pull group 1 into the result.
The two checkboxes
Regex mode and Case-insensitive are the only switches. Case-insensitive appends i to the flags. Hello HELLO with Find hello, Replace with Hi, and the box off reports 0 matches replaced and leaves the text unchanged. With the box on, both words become Hi and the count is 2 matches replaced. The i flag is the JavaScript flag. The page does not add a Unicode flag, so the examples that are guaranteed are plain Latin letters.
There is no multiline checkbox and no dot-all checkbox. A pattern ^draft against draft on line one and draft on line two replaces only the first, leaving X and a newline and draft, one match. A dot does not cross a newline. Flags other than g and the optional i are not offered. An illegal pattern clears Result, hides the count, and prints the engine message. Find [invalid( in Regex mode reports Invalid regular expression: /[invalid(/g: Unterminated character class.
Jobs for a literal swap or a pattern
Use plain mode when the search is a product name, a placeholder, or a file suffix and the characters should stay literal. Use Regex mode when the search is a class such as digits. abc123def456 with Find \d+ and Replace with NUM becomes abcNUMdefNUM, two matches. Overlapping plain matches are not revisited. aaa with Find aa and Replace with b becomes ba, one match, because the search continues after the first pair.
A before-and-after view, without editing, is the text diff viewer. It marks whole lines removed or added. It will not apply Find. Line breaks, numbering, and duplicate removal are line operations. Changing the spelling of one identifier into camelCase or snake_case is the case converter, which rewrites the whole field into five forms and does not search. Paste a copied line here only when a specific string should change.
Dollars, line starts, and empty matches
Zero matches are a success. Find z in abc leaves abc in Result and prints 0 matches replaced. Copy output then copies abc. Empty Find is the failure Enter a find pattern. Result is cleared, so a later copy is empty. Empty Replace with deletes every match. a-b-a with Find - becomes aba and 2 matches replaced. The count grammar is 1 match replaced. for a single hit and N matches replaced. for every other count, including zero.
A pattern that can match an empty string still runs. Find a* in Regex mode against ab inserts the replacement at the empty positions the engine reports, and the sample run produces XXbX with 3 matches replaced. If the result grew instead of shrinking, the pattern matched nothing between characters. Anchor it, or switch Regex mode off. The page does not offer a whole-word box. A search for cat also matches the cat inside category unless the pattern says otherwise. Write the pattern with your own boundaries if the shorter word must stand alone.
Rules and limitations
Replace all is always global. Plain mode escapes regex metacharacters. Regex mode compiles Find as written. Case-insensitive adds i. No m, s, u, or y flag is available. The replacement text is literal, including $1.
Empty Find says Enter a find pattern. and clears Result. An invalid pattern prints the engine message and clears Result. Zero matches keep the original text. Copy output copies Result only. There is no download and no replace-first control.
Common problems
If $1 appeared in the result, that is the literal replacement. This page does not expand backreferences. Inspect groups on the regex tester, then type the text you actually want inserted.
If only the first line changed for a ^ pattern, there is no multiline flag. ^ is the start of the whole Text box. If a continuous hex-looking dump or a word grew extra letters, a zero-width pattern matched between characters.
Frequently asked questions
Does the replacement understand $1?
No. $1, $&, and $$ are copied into the result as typed. (hello) replaced with $1! becomes the characters $1!, not hello!.
Can I replace only the first match?
No. The search is global, and the button is Replace all. A pattern that can match more than once will replace every non-overlapping match.
Is there a multiline option?
No. ^ and $ refer to the whole text, and a dot does not match a newline. ^draft changes a draft at the start of Text and leaves a later line alone.
What does zero matches look like?
Result stays the original text and the count reads 0 matches replaced. An empty Find box is different: it says Enter a find pattern. and clears Result.
Is my input uploaded or saved?
This tool processes input in your browser and does not save its input or output to local storage. Copy and download are user actions. The site uses analytics for page and action metadata and may use ads and production error reporting; see the Privacy Policy for those services.
About this tool
Maintained by Toolbench. For large or deeply nested files, split the input into smaller batches and verify representative results before using them in an import or application. Report reproducible problems through Contact.
Next steps
Related tools
Continue the workflow with nearby tools for formatting, publishing, debugging, or follow-up checks.
Regex Tester
List JavaScript regex matches with index and capture groups.
Open Regex TesterText Diff Viewer
Compare two text blocks line by line, by row index.
Open Text Diff ViewerLine Operations
Sort, reverse, number, trim, or join lines from a pasted block.
Open Line OperationsCase Converter
Convert text to camelCase, snake_case, kebab-case, CONSTANT_CASE, and Title Case.
Open Case ConverterTrust
Policies, contact, and answers
Clear pages for how Toolbench works, what we collect, and how to reach us.