Find and Replace Text
Search and replace across text, with regular expression support.
Find and Replace Text
Instant online text processing
What does Find and Replace Text do?
Replace text across a whole document with options for case sensitivity, whole-word matching and full regular expressions with capture groups. Matches are highlighted and counted before you commit.
How to Use Find and Replace Text
- 1Paste your textAny length.
- 2Enter what to findPlain text, or switch on regex mode.
- 3Enter the replacementMatches are highlighted as you type.
- 4Apply and copyThe replacement count is shown.
Key Features
- Plain text or full regular expression matching
- Case-sensitive and whole-word options
- Capture group references such as $1 in the replacement
- Live match count and highlighting before you replace
- Multiple find-and-replace rules applied in order
- Safe handling of invalid regex, with the error explained
Frequently Asked Questions
How do I use capture groups?
Wrap part of the pattern in parentheses and reference it with $1, $2 and so on. Finding (\w+)@(\w+) and replacing with $2/$1 swaps the two halves of every match.
What does whole-word matching do?
It requires a word boundary at each end, so searching for "cat" will not match "category" or "concatenate". It is the fix for the classic replace-all disaster.
Can I replace line breaks?
Yes, in regex mode. Use \n for a line feed and \r\n for a Windows line ending. Replacing \n with a space joins every line into one.
What happens if my regex is invalid?
The tool reports the error and leaves your text untouched. Nothing is replaced until the pattern compiles.
Everything you paste stays in this page. Text tools run as JavaScript in your browser, so nothing is uploaded, logged or stored.
Related Tools
Regex Tester
Test regular expressions live with highlighted matches and groups.
Text Cleaner
Strip formatting, HTML, smart quotes and invisible characters.
Remove Duplicate Lines
Strip repeated lines from a list, with a count of what went.
Sort Lines
Sort a list alphabetically, numerically, by length or randomly.
