Find & Replace

Find and replace text using plain strings or regular expressions. Supports case-insensitive, whole-word, multiline, and global modes.

Find
Replace with
Text

Frequently Asked Questions

Enable "Use regex" and use $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>.
Leave the "Replace with" field empty. The matched text will be removed and replaced with an empty string, effectively deleting it from the output.
With multiline mode on, the anchors ^ 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.
Enable Use regex to treat the Find field as a regular expression pattern instead of a literal string. For example, \d+ matches any sequence of digits, and [a-z]+ matches lowercase words. If your regex has a syntax error, an error message will appear explaining the issue.
In case-sensitive mode (default), "Apple" and "apple" are different strings. In case-insensitive mode, the search ignores letter case, so "apple" matches "Apple", "APPLE", and "aPpLe".
Enable Use regex and wrap your search term with word boundary anchors: \bword\b. For example, \bcat\b matches "cat" but not "catch", "concatenate", or "tomcat".
Replace all (the 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.
Enable Use regex and use parentheses in the Find pattern to create capture groups. Then reference them in the Replace field with $1, $2, etc. For example: Find (\w+), (\w+), Replace $2 $1 — this swaps "Smith, John" to "John Smith".
In regex mode, characters like . * + ? ^ $ { } [ ] | ( ) \ have special meaning. Prefix them with a backslash to match literally: \. matches a literal period. When Use regex is disabled, all special characters are automatically escaped.
Common uses include: renaming a variable across a code snippet (\bmyVar\bnewVar); reformatting dates with capture groups; stripping HTML tags with <[^>]+> → (empty); removing extra whitespace with \s+ → space; and adding a prefix to each line with ^ → prefix (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, regex, and multiline anchors — 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

Related Articles

In-depth guides and technical articles.

View all →
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.