About the Text Replacer
The Text Replacer finds every occurrence of a word, a phrase or a pattern in your text and replaces it with something else. Paste the text, type what to find and what to put in its place, and the changed text appears next to the original as you type.
It works like the find and replace in a word processor, with a few extras. You can match case or ignore it, replace whole words only, change just the first match, or switch to regular expressions to rearrange dates, add text to the start of every line or remove whole patterns at once.
Quick fixes clean up common problems in one click: double spaces, spaces at line ends, tabs, empty lines, HTML tags and curly quotes. Everything runs in your browser, so your text never leaves your device.
How to use it
- Paste your textPaste into the Original text box or drop a text file onto it. Sample loads two short sentences to try.
- Enter what to findType a word, a phrase or a pattern in Find. Leave Replace with empty to delete every match.
- Set the optionsMatch case, Whole words only, Regular expression and Replace all matches change how matches are found. Replace all matches is on by default.
- Or pick a quick fixChoose one from Quick fixes to fill in a ready-made pattern for common clean-up jobs.
- Check and copyThe status line shows how many matches were replaced. Copy or download the result, or use it as input for another replacement.
Key features
Live preview
The result updates on every keystroke, and the status line counts the replacements.
Case and whole words
Ignore case by default or match it exactly. Whole words only leaves "category" alone when you replace "cat".
Regular expressions
Use JavaScript regular expressions with groups ($1, $2), and \n or \t in the replacement for line breaks and tabs.
Seven quick fixes
Extra spaces, spaces at line ends, tabs to four spaces, empty lines, HTML tags, curly quotes and curly apostrophes.
Safe with slow patterns
A pattern that would freeze the page is stopped after two seconds with a message instead.
Chain replacements
Use as input moves the result back to the left, so you can run several replacements one after another.
Examples
A simple replacement
The Sample button loads this text:
Our office opens at 9am. The office closes at 5pm.
Please call the OFFICE before visiting.
| Find "office", replace with "studio" | Result |
|---|---|
| Default settings | 3 matches replaced, including OFFICE |
| Match case on | 2 matches replaced, OFFICE stays |
| Replace all matches off | 1 match replaced, only the first "office" |
Without Match case, the replacement is inserted exactly as you typed it, so "OFFICE" becomes "studio" in lowercase.
Whole words only
Replacing "cat" with "dog" in cat category concat cat. Cat changes 5 matches and gives "dog dogegory condog dog. dog". With Whole words only, it changes 3 and gives dog category concat dog. dog.
Rearranging dates with a regular expression
Turn on Regular expression, then find (\d{4})-(\d{2})-(\d{2}) and replace with $2/$3/$1:
| Before | After |
|---|---|
| Due 2026-10-06, paid 2026-11-15. | Due 10/06/2026, paid 11/15/2026. |
Each pair of parentheses captures part of the match, and $1, $2 and $3 put those parts back in a new order.
More regular expression jobs
| Find | Replace with | Result |
|---|---|---|
^ | - | Adds "- " to the start of every line |
, | \n | red, green, blue becomes three lines |
(\d+)(am|pm) | $1 $2 | 9am and 5pm becomes 9 am and 5 pm |
Quick fixes
| Quick fix | Before and after |
|---|---|
| Extra spaces to one | too many spacestoo many spaces |
| HTML tags | <p>Hello <strong>world</strong></p>Hello world |
| Curly quotes to straight | “Hello,” she said. "Hello," she said. |
| Curly apostrophes to straight | It’s Jack’s ‘big’ day It's Jack's 'big' day |
Tips
- Check the match count before you copy. If it is higher than you expected, turn on Whole words only or Match case and watch the number drop.
- To delete something everywhere, such as a tracking code or a repeated disclaimer, leave Replace with empty.
- Several changes in a row? Make the first one, click Use as input, then enter the next. Each step is easy to check on its own.
- Regular expressions treat each line separately for ^ and $, so ^ means "start of a line" and $ means "end of a line" anywhere in the text.
- Test a new pattern in the Regex Tester first. It highlights every match and shows the captured groups, which makes mistakes easier to spot.
Common mistakes and limits
- Expecting the original capitals to be keptWith Match case off, every match is replaced with your text exactly as typed. Replacing "office" with "studio" also turns "Office" and "OFFICE" into "studio". Run separate replacements with Match case on if capitals matter.
- Typing \n without Regular expressionOutside regular expression mode, \n is replaced literally as a backslash and an n. Turn on Regular expression to insert a line break.
- Forgetting to escape special charactersIn regular expression mode, characters such as . ? * + ( ) [ ] and $ have special meanings. Find "3.5" also matches "305". Put a backslash before them, as in 3\.5, or turn regular expressions off.
- Removing HTML tags to get clean textThe HTML tags quick fix removes the tags only. Entities such as & stay as they are, and text inside script or style tags is kept. Use the HTML Decoder for the entities.
- Writing a pattern that backtracks too muchPatterns with nested repeats, such as (a+)+$, can take forever on some text. The tool stops them after two seconds; rewrite the pattern without nested repeats.