Skip to main content
SerpGem
Content Tool

Find and Replace

Find every match in a block of text and replace them in one click — with regex, whole-word, and case-sensitive options. Live match count as you type.

InputText to search
OutputReplacement result
(empty)

Use this with

See all 10 tools

Find and Replace Guide

When the editor's Ctrl+H isn't enough

Most text editors have find-and-replace built in — but few support proper regex with capture groups, and none work on pasted text you don't have open in an editor. This tool gives you full JavaScript regex on arbitrary text, right in your browser.

Literal text replace

Leave regex off and you get classic find-and-replace. Type what you're looking for, type the replacement, see the match count update live.

Whole word matching

Toggle 'whole word' to match complete words only — 'cat' won't match inside 'category' or 'concatenate'. Essential when replacing common short words in long documents.

Full regex with capture groups

Turn on regex mode and you get the full JavaScript engine — lookbehinds, character classes, quantifiers, groups, everything. Use $1, $2 in the replacement to reference captured groups.

Case-sensitive or not

Default is case-insensitive because that's usually what you want. Toggle case-sensitive for precise replacements (e.g., replacing 'US' the country code but not 'us' the pronoun).

Multiline mode for ^ and $

By default ^ and $ match start/end of the entire input. Toggle multiline to make them match start/end of each line — useful for line-prefixing with regex like /^/ → '- '.

Safe — nothing leaves your browser

All searching and replacing happens in JavaScript on your device. We never upload your text. Safe for confidential content, client drafts, and internal docs.

Pro Tips

Common regex patterns

Email: /[\w.+-]+@[\w-]+\.[\w.-]+/g. URL: /https?:\/\/[^\s]+/g. Multiple spaces: / {2,}/g. Trailing whitespace: /[ \t]+$/gm (needs multiline on).

Escape special chars

In regex mode, . * + ? ^ $ { } ( ) | [ ] / \ have special meaning. Escape with \ to match literally (e.g., \. for a literal period).

Capture groups

Wrap patterns in () to capture. /(\w+)@(\w+)/ with replacement $2/$1 swaps the two halves of an email. Powerful for reformatting bulk lists.

?

Frequently Asked Questions

How is this different from my editor's Find and Replace?
Most editors do find-and-replace, but their regex is either limited or hidden behind menus. This tool gives you the full JavaScript regex engine in a clear UI with live match counts — and it works on pasted text without opening a file.
Why does my regex not match what I expect?
Regex is finicky. Common issues: the g flag is always on here (so every match replaces); dots don't match newlines by default; special chars need escaping. Start small — test with a single match before running on a big document.
Can I do case-preserving replace?
Not directly — this is a simple replace, not a smart one. If you need 'FOO' → 'BAR' but 'Foo' → 'Bar' too, do it in two passes: one case-sensitive replace for each casing.
What's the maximum size of text I can paste?
Comfortably over 1MB of text. The regex engine handles large inputs well, though very complex patterns (e.g., nested quantifiers) can slow down on huge documents.