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
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.
Regex for Data Cleaning: Practical Patterns for Messy Real-World Data
Real-world data — phone numbers, dates, emails, log entries, product codes — arrives inconsistently. Here are the regex patterns for the most common data cleaning tasks: phone normalisation, date standardisation, HTML stripping, whitespace cleaning, and log redaction.
Find & Replace — Text Substitution with Regex, Case Options & More
Learn how find and replace works beyond basic text substitution — regex patterns, whole word matching, case sensitivity, backreferences — with real examples for data cleaning, templates, and code refactoring.