Find & Replace
Find and replace text in any multi-line input. Supports plain text and regular expressions with case-insensitive matching.
Frequently Asked Questions
$1, $2, etc. in the replacement to reference capture groups. For example, find (\w+)\s(\w+) and replace with $2 $1 to swap two words. Named groups use $<name>.^ and $ match the start and end of each line, not just the start and end of the entire string. This is essential when using regex to target line beginnings or endings.\d+ matches any sequence of digits, and [a-z]+ matches lowercase words. You can use regex flags like case-insensitive (i) and global (g) via the checkboxes. If your regex has a syntax error, an error message will appear explaining the issue.
\bword\b. For example, \bcat\b matches "cat" but not "catch", "concatenate", or "tomcat". The \b anchor matches the boundary between a word character (\w) and a non-word character, ensuring only whole-word occurrences are replaced.
g flag, enabled by default) replaces every occurrence of the match in the text. Replace one (uncheck "Replace all occurrences") replaces only the first occurrence found. Replace one is useful when you want to change only the first instance of a term — for example, replacing the first usage of a word with its full form before subsequent abbreviations.
$1, $2, etc. For example: Find (\w+), (\w+), Replace $2 $1 — this swaps "Smith, John" to "John Smith". Named groups use the syntax (?<name>...) in the pattern and $<name> in the replacement.
. * + ? ^ $ { } [ ] | ( ) \ have special meaning. To search for a literal dot or parenthesis, prefix it with a backslash: \. matches a literal period, \( matches a literal opening parenthesis. When Use regex is disabled, all special characters are automatically escaped so they are treated literally — no manual escaping required.
\bmyVar\b → newVar); reformatting dates from MM/DD/YYYY to YYYY-MM-DD using capture groups; replacing a brand name across marketing copy; stripping HTML tags with <[^>]+> → (empty); removing extra whitespace with \s+ → space; and adding a prefix to each line with ^ → the prefix text (in multiline mode).
About This Find & Replace Tool
This free find and replace tool searches any text for a string or regular expression pattern and replaces all matches with a replacement string. Supports case-sensitive search, whole-word matching, and regular expressions — all processing happens in your browser.
When to use this tool
- Batch-replacing a variable name or term across copied code
- Normalising inconsistent spellings in a document
- Replacing placeholder text in a template
- Stripping unwanted characters or patterns from pasted data
Standards & References
How It Works
Enter Find & Replace
Type the search term in the Find field and the replacement in Replace. Paste your content into the text area.
Set Options
Enable Regex mode for pattern matching, toggle case sensitivity, replace-all vs. first match, and multiline flag for anchors.
See Results
The replacement count and modified text appear instantly. Regex capture group backreferences like $1 are fully supported.
Common Use Cases
Bulk Text Editing
Replace a word or phrase across an entire document in one operation. Ideal for updating brand names, product names, or outdated terminology.
Regex-powered Transforms
Use regex to match patterns — like dates in YYYY-MM-DD format — and reformat them using capture group backreferences in the replacement string.
Code Refactoring
Rename a variable or function across a snippet of code. Regex with word boundaries (\b) ensures only whole-word matches are replaced.
CSV & Data Cleanup
Replace delimiters, fix decimal formats, or strip unwanted characters from exported data before importing to another system.
Template Substitution
Replace placeholder tokens like {{name}} or [DATE] in email or document templates with the real values.
HTML & Markdown Editing
Strip or replace HTML tags, convert Markdown syntax, or swap shortcodes without opening a full code editor.
Related Text Tools
Related Articles
View all articles
Why sed's s/old/new/g Fails With File Paths — Delimiters, Capture Groups, and the GNU vs BSD sed Difference
sed's `s/old/new/g` fails when patterns contain forward slashes (like file paths) — but any character can be the delimiter: `s|/usr/local|/usr/share|g` works identically. Here's the complete sed substitution syntax including & for matched content and \1 capture groups, the -i in-place editing difference between GNU sed (Linux) and BSD sed (macOS), and why grep-first-then-sed is the workflow that prevents data loss.
Regex Works on Characters, Not Structure — Why It Fails on CSV, HTML, and JSON (and What to Use Instead)
Regex operates on characters, not structure — and applying it to CSV, JSON, or HTML routinely produces wrong results because the same pattern can appear in both structural positions (delimiters, field names) and content positions (inside field values). Here's why commas inside quoted CSV fields confuse naive regex, the HTML-parsing-with-regex problem, when regex on structured text is actually acceptable (log files, single-field formats), and the correct parsers for each format.
Find & Replace Beyond Basics: Regex Capture Groups, Multi-Cursor Editing, and Safe Project-Wide Replace
Find-and-replace with regex capture groups doesn't just substitute text — it can restructure it, swapping argument order or reformatting dates by reusing captured values in the replacement. Here's how capture-group replacements work, when multi-cursor editing is the better tool instead, case-modification syntax for naming-convention conversions, and safe practices for project-wide replace operations.
Catastrophic Backtracking: Why a Regex That Works Instantly in Testing Can Hang Forever on Real Data
A find-and-replace that works instantly on a 100-character test string can take minutes (or never finish) on a 10,000-character real document — not because the engine is slow, but because certain regex patterns cause processing time to grow exponentially with input length. Here's how "catastrophic backtracking" works with patterns like (a+)+b, why it's invisible on short test inputs, why it's also a recognized security vulnerability (ReDoS), and how to recognize vulnerable pattern structures.
Automating Text Transformations in Spreadsheets: SUBSTITUTE, REGEXREPLACE, and Bulk Editing
Excel and Google Sheets have SUBSTITUTE, REGEXREPLACE, PROPER, and TRIM functions that automate text transformation across thousands of cells. Here's chained SUBSTITUTE formulas, REGEXREPLACE for phone number formatting and HTML stripping, and practical workflows for cleaning product exports and generating URL slugs.