Free Online Tool
Find and Replace Text
Replace words or patterns in bulk with match case, whole word and regex options.
Your converted text will appear here…
About
About find and replace
Paste your text, type what to find and what to replace it with, and the result updates live along with the number of matches. Turn on match case or whole word for precision, or regular expressions for pattern-based edits.
How to Use
-
Paste your text
Type or paste into the input box.
-
Enter find and replace
Set the options below the boxes.
-
Copy the result
Copy the updated text from the result box.
Reference
Regular expression cheat sheet
Turn on “Regular expression” to use patterns. The tool uses JavaScript regex syntax and replaces every match.
| Pattern | Matches |
|---|---|
. |
Any character except a line break |
\d |
A digit, 0 to 9 |
\w |
A letter, digit or underscore |
\s |
A space, tab or line break |
\b |
A word boundary |
^ and $ |
The start and end of the whole text, not of each line |
[abc] |
One of a, b or c |
[^abc] |
Any character except a, b or c |
a* a+ a? |
Zero or more, one or more, zero or one |
a{2,4} |
Between two and four in a row |
(abc) |
A capture group you can reuse as $1, $2 and so on |
cat|dog |
Either cat or dog |
Replacement tokens
$1, $2- The text captured by the first, second, … group.
$&- The whole match.
$<name>- A named group, written (?<name>…) in the pattern.
$$- A literal dollar sign. Tokens work in every mode, so use $$ whenever you want a plain “$”.
Examples
| Task | Input | Find | Replace | Result |
|---|---|---|---|---|
| Swap “Last, First” to “First Last” | Lovelace, Ada | (\w+), (\w+) |
$2 $1 |
Ada Lovelace |
| Remove every digit | Order 66 shipped | \d |
empty | Order shipped |
| Collapse repeated spaces | too many spaces | {2,} |
|
too many spaces |
| Wrap each number in brackets | Rooms 12 and 7 | \d+ |
[$&] |
Rooms [12] and [7] |
| Change a word, not parts of words | cat and category | cat (Whole word) |
dog |
dog and category |
Help
Frequently Asked Questions
Can I use regular expressions?
Yes. Enable 'Regular expression' and use JavaScript regex syntax, including capture groups like $1 in the replacement.
What does 'Whole word' do?
It only matches the search term when it stands alone, so 'cat' will not match 'category'.