Find and Replace Text
Find and replace text with optional regex, case, and multiline matching
Input
Result0 replaced
About
Find and replace text in a document. Toggle literal vs regex matching, case sensitivity, and multiline mode. The number of replacements is shown live. Everything runs in your browser; nothing is uploaded.
Examples
Literal find and replace
text: The quick brown fox jumps over the lazy dog
find: fox
replace: wolfThe quick brown wolf jumps over the lazy dog
Matches: 1Every occurrence of the literal string 'fox' is replaced with 'wolf'. The count reflects the number of replacements made.
Regex replace with capture groups
text: user-01: Alice, user-02: Bob, user-03: Carol
find: user-(d+): (w+)
replace: [$1] $2
flags: g[01] Alice, [02] Bob, [03] Carol
Matches: 3$1 is the first capture group (the number) and $2 is the second (the name). Each match is reformatted according to the replacement pattern.
About this tool
Find & Replace is a staple of any text editor, but this tool goes further: it supports both literal and regex modes, live match counts, and the full range of JavaScript replace() patterns including $1/$& capture groups in regex mode. It is a quick way to preview a global substitution without opening a full IDE.
In literal mode the replacement string is treated verbatim — $ is not special. In regex mode, the replacement string honours $1, $2… for numbered groups, $<name> for named groups, $& for the whole match, and $$ for a literal $. An invalid regex is caught immediately and an error is shown.
How to use
Paste your text
Drop the text you want to search and replace in. The search and replacement inputs are separate so you can iterate without retyping.
Choose search mode
Toggle Literal or Regex. Literal mode does a straight string match; Regex mode interprets the Find input as a JavaScript regular expression with the chosen flags (case-sensitive, multiline).
Preview and copy
The match count updates live as you type. Click Copy to grab the replaced text.
Use cases
Batch-renaming keys in a JSON file
Use a regex to match and rename object keys across a large JSON document, with a live preview of every replacement before committing.
Reformatting log lines
Strip timestamps, extract fields, or normalise log output with a regex that captures and rearranges the parts you care about.
Wrapping text in markup
In literal mode, wrap every occurrence of a string in HTML tags or Markdown syntax without needing a full editor.
Common mistakes
Mistake:Forgetting the global flag (g) for a regex.
Fix:Without the g flag, only the first match is replaced. For a global substitution, always enable the 'g' flag or use the regex flag toggle in the UI.
Mistake:Treating the replacement string as a regex.
Fix:In literal mode the replacement is verbatim text. If you type $1 in the replacement, it appears literally — not as the captured group. Switch to Regex mode for capture group support.
Mistake:Writing a regex that matches too much.
Fix:A regex like .* is greedy and will consume as much as possible. Use .*? (non-greedy) or a more specific character class to avoid over-matching.
Frequently asked questions
Related guides
References & standards
Related tools
TOML Validator
Validate TOML and re-emit it as clean, indented JSON
TOML to JSON Converter
Convert TOML to JSON and JSON to TOML in either direction
JSON Lines Converter
Convert JSON Lines (NDJSON) to a JSON array and back
CSV to SQL Converter
Generate SQL INSERT statements from CSV data
JSON Schema Validator
Validate a JSON document against a JSON Schema
CSV to Markdown Converter
Convert CSV to a Markdown table and Markdown tables back to CSV