Find and Replace Text and Clean Text
Paste your text, then find and replace words with several rules at once, including regex, or remove line breaks, extra spaces, emoji, duplicates and special characters in one click. Every match is counted and highlighted before you change anything, and Undo takes you back.
Advertisement
How to find and replace or clean text
- Paste your text into the box.
- Type what to find and what to replace it with. Matches are highlighted and counted as you type. Tick Aa for match case, Word for whole words or .* for regex.
- Add rules for more replacements; they run in order from top to bottom.
- Press Replace all, or tick clean-ups and press Clean text.
- Copy the result. Undo steps back through every change.
Regex recipes
Paste a pattern into Find, tick .* and press Replace all. Every result below comes from the same code that runs in the tool.
| Task | Find | Replace | Before → after |
|---|---|---|---|
| Swap a date to day/month/year | (\d{4})-(\d{2})-(\d{2}) | $3/$2/$1 | Due 2026-10-19 → Due 19/10/2026 |
| Remove trailing spaces | [ \t]+$ | (empty) | end → end |
| Collapse three or more blank lines | \n{3,} | \n\n | a↵ → a↵ |
| Remove numbering at the start of lines | ^\d+[.)]\s* | (empty) | 1. Nasi↵ → Nasi↵ |
| Put each item on its own line | ,\s* | \n | kopi, teh, milo → kopi↵ |
| Wrap every number in bold HTML | \d+(?:\.\d+)? | <b>$&</b> | RM2.50 x 3 → RM<b>2.50</b> x <b>3</b> |
| Change RM10 to 10 ringgit | RM(\d+) | $1 ringgit | RM10 or RM25 → 10 ringgit or 25 ringgit |
Advertisement
What each clean-up does
| Clean-up | Before | After |
|---|---|---|
| Remove line breaks (keep paragraphs) | Line one↵ | Line one line two.↵ |
| Remove extra spaces | Too many spaces | Too many spaces |
| Remove duplicate lines | apple↵ | apple↵ |
| Sort lines A to Z | item 10↵ | Item 1↵ |
| Remove emoji | Terima kasih 🙏🏽 🇲🇾! | Terima kasih ! |
| Remove HTML tags | <p>Hello <b>world</b></p> | Hello world↵ |
| Remove accents (é → e) | Café crème | Cafe creme |
| Remove numbers | Bilik 12A, tingkat 3 | Bilik A, tingkat |
| Remove punctuation | Hi! (Ok?) #tag | Hi Ok tag |
| Remove URLs | See https://example.com now | See now |
Tip: clean-ups run in the order listed, so HTML tags are removed before spaces are tidied. Check the result before pasting it into your website, and keep a copy of the original.
Sources
Frequently asked questions
How do I find and replace text online?
Paste your text, type the word to find and its replacement, and the tool counts and highlights every match before you change anything. Press Replace all to apply it, or Undo to go back. Add more rules to make several replacements in one go; they run from top to bottom.
How do I remove line breaks from text?
Tick Remove line breaks and press Clean text. Single line breaks inside a paragraph become spaces while blank lines between paragraphs stay, which fixes text copied from a PDF or email. Choose Join everything into one line to remove every break. For example "Baris pertama / baris kedua. / (blank line) / Perenggan baru" becomes "Baris pertama baris kedua." followed by "Perenggan baru" as its own paragraph.
How do I use regex in find and replace?
Tick .* to treat the Find box as a JavaScript regular expression. Use groups in the replacement: $1, $2 for numbered groups, $<name> for named groups and $& for the whole match. For example, find (\d+)-(\d+)-(\d+) and replace with $3/$2/$1 to turn 2026-10-19 into 19/10/2026. ^ and $ match at the start and end of each line.
How do I replace text with a new line?
Type \n in the Replace box. For example, find a comma followed by a space and replace with \n to put each item of a list on its own line. \t inserts a tab. This works with or without regex.
How do I remove emoji or special characters?
Tick Remove emoji to delete every emoji, including skin-tone, flag and family emoji made of several characters. Remove special characters keeps letters (including accented and non-Latin letters), numbers, spaces and basic punctuation. Remove punctuation deletes every punctuation mark and symbol.
Can I remove duplicate lines and sort a list?
Yes. Remove duplicate lines keeps the first copy of each line, ignoring leading and trailing spaces. Sort lines A to Z uses natural order, so item 9 comes before item 10, and ignores upper and lower case. Remove empty lines deletes blank lines.
Is my text saved or uploaded?
Nothing is uploaded: every replacement runs in your browser. Your last text and rules are kept in this browser's storage so they survive a reload; Clear removes the text. Very long texts of several megabytes work, and the highlighted preview shows the first 20,000 characters.
Share this find and replace tool
Advertisement