Find & replace
Replace literal text or JavaScript regex matches, with controls for case and first or all matches.
- 1Add input
- 2Adjust settings
- 3Get your result
Tool input and files are processed in this browser without being uploaded.
Before you start
Find exact text by default, with case matching and all matches enabled. Add replacement text, or leave it blank to delete matches. Turn on regular expressions when you need patterns, then run the tool and check the resulting text.
How to use this tool
- Paste content into “Text”, or load the example to try it.
- Enter the text to search for in “Find” and the replacement text in “Replace with”. Choose whether to match case and whether to replace the first match or all matches. Turn on regex mode if needed, then select “Find and replace”.
- Read the result and match count, then use “Copy result” or download result.txt. For another pass, choose “Use result as input”.
Supported inputs and limits
Paste up to 1 MiB (1,048,576 UTF-8 bytes), including spaces and line breaks. All option values together have a 2 MiB UTF-8 budget; very long Find or Replace with values may also need shortening.
Regex patterns may contain at most 4,096 UTF-16 code units. Regex processing has a two-second timeout once the Worker is ready; loading has a separate 30-second timeout. The final text result is limited to 30 MiB of UTF-8 bytes.
Find is required. A blank replacement deletes matches; if there is no match, the source is returned unchanged. Empty source text is allowed, and regex patterns that match empty positions can insert text.
Worked example
Example input
a.b.a.b
Example options
{
"find": ".",
"replacement": "X"
}Example output
aXbXaXb
When something does not work
Keep a copy of the original text. If the result changes too much, turn off “Replace all matches”, narrow Find or switch off regex mode, then run again. Shorten input or replacement text if a limit is reached. A processing failure clears the result; an edit, cancelled run or missing required field may leave the previous result visible, so run again before using it.
Frequently asked questions
Where does the tool process my text?
It runs locally in a Worker in your browser. Tool switches can keep input and retained results temporarily in the same tab, within cache limits. Refreshing or closing the tab clears that workspace; save the source and any result you need before then.
How do replacement tokens work?
With regex mode off, Replace with is inserted literally: $& stays $&. In regex mode, $& inserts the match, $1 and other valid numbered groups insert captures, and $<name> inserts a named capture when the pattern has named groups. $$ inserts a dollar sign; $` and $' insert the text before or after the match. Typing \n in Replace with keeps a backslash and n; it does not insert a line break.
What does the count mean, and can I reuse the result?
The count records matches processed, including matches whose replacement leaves the text unchanged. “Copy result” and result.txt contain the full text. “Use result as input” replaces the input and saves its previous text; “Undo input change” restores that saved text once. It does not restore earlier edits or option settings. “Use result as input” is disabled while processing or while its result is stale.
Documentation & further reading
Related tools
TXT to UTF-8
Read a TXT file with the right source encoding and save it as UTF-8.
Merge TXT files
Combine TXT files in your chosen order and save one UTF-8 text file.
Word counter
Words, characters, and paragraphs at a glance.
Case converter
Change pasted text to uppercase, lowercase or simple capitalized forms.