Find and Replace
Guide: How to Clean Up Text Copied From PDFs and Websites
No matches.
Nothing you enter or choose here leaves your device. This tool runs in your browser.
Start with a count
The tool replaces every match at once and tells you how many it changed. Treat that number as a check. If you expected 12 replacements and see 112, your search matched more than you meant. Undo by editing the search and watching the count change before you copy the result.
The three options
| Option | Does | Example |
|---|---|---|
| Match case | Treats A and a as different | Find Apple and leave apple alone |
| Whole word | Matches only complete words | Find cat, skip category |
| Regular expression | Reads your search as a pattern | Find \d+ for any run of digits |
Recipes using regular expressions
| Goal | Find | Replace with |
|---|---|---|
| Collapse repeated spaces | \s{2,} | A single space |
| Swap first and last name | (\w+) (\w+) | $2, $1 |
| Wrap every number in brackets | \d+ | [$&] |
| Remove extra blank lines | \n\n+ | A single line break |
| Change US to UK spelling of color | \bcolor\b | colour |
| Remove all digits | \d | Nothing |
In the replacement, $1 is the first bracketed group, $& is the whole match, and $<name> is a named group. The regex tester is the place to build and check a pattern before you use it here.
Characters that need a backslash
With the regular expression box ticked, these have a special meaning: the full stop, question mark, star, plus, brackets, pipe, caret and dollar sign. To find one literally, put a backslash before it. To remove a literal full stop, search for \., not ., which matches every character.
Safe habits
- Copy your original text somewhere first.
- Do one change at a time, so you can see which one went wrong.
- Use Whole word when the search term is short.
- Check a few results by eye, particularly the first and last.
- Use the result as the next input to chain several replacements.
A pattern that hangs
Some regular expressions take extremely long on certain text, especially ones with nested repeats. The tool stops after two seconds so your browser stays responsive. If that happens, make the pattern more specific.
Your text stays in your browser. To compare the before and after, paste both into the text diff. Fixing line breaks specifically? The remove line breaks tool has options for it, and the guide on cleaning up copied text lists more fixes.
Everyday jobs
- Fix a name that was spelled two ways across a long document.
- Change a date format, such as turning 2026-03-08 into 08/03/2026, with groups and a replacement like
$3/$2/$1. - Strip tracking tags from a list of links by finding
\?utm_[^\s]*and replacing with nothing. - Replace curly quotes copied from a word processor with straight ones before pasting into code.
Written by Akinrinmade Michael · Updated October 24, 2026
How to use
- 1Paste your text into the box.
- 2Type what to find and what to replace it with.
- 3Choose options such as match case, whole word or regular expression.
- 4Read the result and click Copy, or use it as the next input.
Frequently asked questions
Does it replace every match?
Yes. All matches are replaced at once, and the tool tells you how many were changed.
How do I use regular expressions?
Tick "Regular expression" and write a pattern, such as \d+ for numbers. In the replacement, $1 is the first group, $& is the whole match and $<name> is a named group.
What does "Whole word" do?
It only matches complete words, so finding "cat" leaves "category" alone.
Why did it say the pattern took too long?
Some regular expressions can take extremely long on certain text. The tool stops them after two seconds so your browser never freezes. Make the pattern more specific.
Read the guide
Learn how this works and how to get the most from it.
Writing & text
How to Clean Up Text Copied From PDFs and Websites
Fix broken line breaks, double spaces and stray characters in copied text, then sort, number and tidy it in a few clicks.
3 min read
Related tools
Remove Line Breaks
Join lines into one paragraph. Strip breaks from copied text.
Sort & Dedupe Lines
Sort lines A-Z, reverse them, remove duplicates and trim whitespace.
Regex Tester
Test regular expressions live, with match highlighting and groups.
Case Converter
Switch text to UPPER, Title, camelCase, snake_case and more.