Find & Replace

Advanced text search with regex support, live preview, and replacement history.

Processed in your browser — your text never leaves your device.
No matches
Search Options
Actions
Runs entirely in your browser. No uploads. Your files stay private.

How Find and Replace Works in This Tool

Find and Replace is a thin UI on top of the browser's native RegExp engine. Every search compiles a JavaScript RegExp object with the global flag 'g' (and 'i' when case-insensitive is on), then walks the input with regex.exec() in a loop to collect every match index. Plain-text mode escapes regex metacharacters before compiling so that dots, parentheses, and dollar signs are treated literally.
Whole-word mode wraps your query with the \b word-boundary anchor on both sides. That works as expected for ASCII identifiers but has known gaps with Unicode: \b is defined against [A-Za-z0-9_], so a search for 'caf' inside 'cafe' counts as a word boundary against the 'e' even when the trailing letter is accented (cafe vs café). For non-Latin word boundaries you usually need regex mode with explicit Unicode property escapes.
Regex mode passes your pattern straight to new RegExp(), so the full JavaScript flavor is available: alternation, character classes, lookaheads and lookbehinds, capture groups, named groups, and Unicode property escapes (\p{Letter}, \p{Number}, requires the 'u' flag if you add it). Capture groups can be referenced in the replacement as $1, $2, and so on. An invalid pattern surfaces the engine error message inline rather than crashing the page.
Preserve-case mode inspects the original match before replacing: ALL CAPS matches become ALL CAPS replacements, Title Case matches become Title Case replacements, lowercase stays lowercase, and mixed case falls back to the literal replacement string. This is helpful when renaming a term that appears at the start of sentences as well as inside them.
Ignore-extra-spaces builds a flexible regex that allows any run of whitespace (\s+) wherever your query has a single space. Match indices are calculated against the original text so highlights line up correctly even though the underlying pattern was loosened. This is the right choice when copy-pasting from PDFs or Word documents that introduce stray spaces.
Live preview, replace history, and the split or unified view are all client-side state. Settings and the last twenty replace operations persist via localStorage under 'find-replace-settings' and 'find-replace-history' keys, so your preferences survive a reload without anything ever reaching a server.
Performance is dominated by regex.exec rather than rendering. Inputs in the multi-megabyte range are still interactive, but pathological patterns (catastrophic backtracking with nested quantifiers like (a+)+) can hang the tab — that is a property of every JavaScript regex engine, not specific to this tool. If a pattern looks slow, anchor it with ^ or $ where possible, or simplify the alternation.

Common Use Cases

01

Bulk variable rename

Toggle whole-word mode and replace 'userId' with 'accountId' across a pasted code block without touching 'userIdList' or 'userIdentifier'.

02

Date format migration

Use regex (\d{2})/(\d{2})/(\d{4}) and replacement $3-$1-$2 to convert MM/DD/YYYY dates into ISO-8601 YYYY-MM-DD across a CSV column.

03

Stripping HTML tags

Run the regex <[^>]+> with an empty replacement to remove every angle-bracketed tag from copied web content while keeping the text.

04

PII redaction

Replace email addresses with [REDACTED] using the regex [\w.+-]+@[\w.-]+\.[A-Za-z]{2,} before sharing logs externally.

Frequently Asked Questions

Whatever the browser's JavaScript engine implements, which today means full ECMAScript regex: alternation, lookaheads, lookbehinds, named groups, Unicode property escapes, and backreferences. The 'g' flag is always on; 'i' is added when case-insensitive is enabled. Patterns are compiled with new RegExp() and any syntax error is shown inline.
Standard JavaScript replacement syntax: $1 through $9 reference numbered groups, $& references the entire match, and $$ inserts a literal dollar sign. Named groups are supported via $<name>. Capture groups only fire in regex mode; in plain-text mode the replacement string is used verbatim.
It wraps your query with \b on both sides. \b is a zero-width assertion at the boundary between a word character (A-Z, a-z, 0-9, underscore) and a non-word character. That means searches for ASCII identifiers behave correctly, but accented characters and CJK text are treated as word boundaries because they fall outside the \w class.
It detects whether the matched text is ALL CAPS, Title Case, or all lowercase, then applies the same casing pattern to the replacement before inserting it. Use it when the same term appears at the start of sentences and inside them, and you want both forms updated without writing two separate find-replace passes.
Each space in your search query is replaced with \s+ inside the compiled regex, so any number of whitespace characters (including newlines and tabs) will satisfy that position. Match indices still point to the original text so highlighting and replacement length stay accurate.
JavaScript's regex engine is backtracking, which means nested quantifiers like (a+)+ on long inputs can hit catastrophic backtracking and freeze the tab. Anchor patterns with ^ or $, prefer atomic alternatives, and avoid overlapping quantifiers. That behavior is engine-wide, not unique to this tool.
No. Both settings and the last twenty replace actions are written to localStorage in your browser. The keys are 'find-replace-settings' and 'find-replace-history'. Clear them by clicking History then the trash icon, or via DevTools > Application > Local Storage.
Yes. Each replace creates a history entry with the original find and replace strings and the count. Click an entry to reload that pattern, but the tool does not auto-revert the text — copy the original input back from the History panel or paste it again.
Yes, with caveats. Match collection is O(n) for simple patterns, so logs in the low megabyte range stay interactive. The render layer caps highlight rendering above a threshold to keep scrolling smooth; the underlying replace still runs over the full text.
The regex engine treats the input as a single string by default, so . does not match newlines unless you switch to regex mode and use the dotall pattern [\s\S] (or add the 's' flag inside the pattern with /(?s)/). ^ and $ match start and end of the whole string unless you use the multiline 'm' flag, which can be added inline as (?m).

Advertisement