Find and Replace Text: Literal and Regex Substitution
Use this tool to replace literal text or JavaScript regular-expression matches. Enter a value in Find, set Replace with, review the match count, highlighted input, and replacement preview, and see the current result update automatically.
Choose a Matching Mode
Select Literal text to match the Find value as ordinary characters. Symbols such as . and $ are not treated as regex syntax. Select Regular expression to interpret Find as a JavaScript regular expression. This mode supports capture groups and replacement references such as $1 and $<name>. Invalid patterns show an error.
Set Matching and Replacement Options
- Case sensitive: Match letter case when enabled.
- Whole word: Match only word-boundary occurrences.
- Multiline (^ $): In regular-expression mode, let
^and$match the start and end of each line. In Literal text mode, the Find value is escaped, so these symbols are not regex anchors. - Replace all: Replace every match.
- Replace first: Replace only the first match.
How to Use the Tool
- Paste text into the input area, or upload or drop a text file. Uploaded files are read as text.
- Enter the search value in Find and the new value in Replace with.
- Select Literal text or Regular expression, then set the matching options and replacement scope.
- Review the live match count, highlighted matches, and output preview.
- Review the replacement result, which updates automatically.
- Use Copy or Download to get the output.
Remove Matches with an Empty Replacement
Leave Replace with empty to remove matched text. Replace all removes every match; Replace first removes only the first match. The displayed count and highlighting can be capped at 20,000 matches. The same live preview and export controls remain available.
Review, Copy, and Download
The output preview updates from the current input and settings. Copy copies the current output value. Download creates a plain-text file named find-and-replace-result.txt.
Limits and Browser-Side Processing
Matching and replacement run in the browser. The live match count and highlighted matches stop at 20,000 matches; when that limit is reached, the status displays capped at 20000. The displayed count and highlighting therefore may not show every match in a larger input.
Frequently Asked Questions (FAQs)
What's the difference between Literal text and Regular expression?
Literal text treats your Find value as plain characters - every symbol is matched exactly as typed, even things like . or ( that would normally have special meaning. Regular expression treats the Find value as a JavaScript regular expression, so patterns, character classes, and capture groups work as expected.
How do I use capture groups in the replacement?
Select Regular expression, wrap the parts of your pattern you want to reuse in parentheses, then reference them in Replace with using $1, $2, and so on (or $<name> for named groups). For example, searching (\w+)@(\w+) and replacing with $2@$1 swaps the two halves of every match.
How do I remove matches instead of replacing them?
Leave Replace with empty to remove matches. Replace all removes every match, while Replace first removes only the first match. The displayed count and highlighting can be capped at 20,000 matches.
How does the live preview work?
Yes. The output preview always reflects the current input and matching settings.
Is my text sent to a server?
No. Matching and replacement run entirely in your browser using native JavaScript regular expressions. Nothing is uploaded.