How to find and replace text
Start with text in Input text, then enter the characters or pattern to change in Find. Replace with controls the new text. The page updates the match count, highlighted input, and Replacement output as you edit those fields and the matching settings. Choose Literal text for exact characters or Regular expression for patterns and capture groups.
- Enter text in Input text or select Upload to load a .txt file.
- Type the value or pattern to search for in Find, then enter the new text in Replace with.
- Choose Literal text or Regular expression under Match mode.
- Choose Replace all or Replace first under Replacement scope, then set any Matching options.
- Use Copy or Download for the current Replacement output.
How to use literal text or regular expression matching
Literal text treats every character in Find as ordinary text, including symbols that have a special meaning in a pattern. Regular expression reads Find as a JavaScript regular expression, so character classes, anchors, and capture groups can control the match. An invalid pattern shows an error, keeps the input in place, and leaves the output equal to it.
Input text: Hello world
Find: world
Replace with: planet
Replacement output: Hello planet
For a capture-group replacement, choose Regular expression and search with (\w+)@(\w+). Replace with $2@$1 swaps the two captured parts. Named groups use syntax such as $<name>.
What the matching options change
- Case sensitive matches letter case as entered. With it off, uppercase and lowercase letters can match each other.
- Whole word adds word boundaries around the search pattern, so the match must start and end at a word boundary.
- Multiline (^ $) makes
^and$match the start and end of each line in Regular expression mode. Literal text escapes these symbols, so they remain ordinary characters.
How to replace text, replace the first match, or remove matches
Replace all changes every match found by the current pattern. Replace first changes only the first match. The count and highlights still show the matches found in the input.
Input text: cat cat
Find: cat
Replace with: dog
Replace first: dog cat
Replace all: dog dog
Leave Replace with empty to remove matched text. If Find is empty, the output stays equal to Input text. The displayed count and highlighted matches stop at 20,000 matches. Replacement still follows the selected scope.
Examples with Find and Replace Text
- Change a repeated product name in release notes with Literal text, then use Copy for the revised text.
- Change a configuration token throughout pasted text with Replace all, then use Download to save the Replacement output.
- Use Regular expression and capture groups to rearrange two parts of each matching value, then check the preview.
When another text transformation tool fits better
Use Text Transformation Tools to choose another text operation. HTML Entity Encoder / Decoder handles HTML entity references. Choose Unicode Normalizer for NFC, NFD, NFKC, or NFKD normalization. Use Split or Join Paragraphs to split sentences or join and unwrap paragraph line breaks.
Frequently asked questions
How do I find and replace text with a regular expression?
Choose Regular expression, enter the JavaScript pattern in Find, and enter the replacement in Replace with. Use Replace all or Replace first to set how many matches change.
What does Replace first do?
Replace first changes only the first match in the replacement output. The count and highlights still report the matches found in the input.
How can I remove text with Find and Replace Text?
Leave Replace with empty and choose Replace all or Replace first. The selected scope removes every match or only the first match from the output.
How many matches can the preview show?
The match count and highlighted preview stop at 20,000 matches. The status then displays capped at 20000.
Does Find and Replace Text send my text to a server?
The matching and replacement logic runs in your browser. The page script contains no request that sends the entered text to a server.