Find and Replace
Text ToolsFind and replace text with regex support, case sensitivity, whole-word matching, and preview of all changes before applying.. Free, private — all processing in your browser.
The Find and Replace tool performs bulk text replacement across any pasted content with precise control over what matches and what does not. Plain find-and-replace is one thing; this tool adds regex patterns, whole-word matching (so replacing \"cat\" does not affect \"catalog\"), case sensitivity toggling, multi-line mode, and a full preview of every match before you apply the change. Use it for rewriting URLs across a document, bulk-renaming variable references in code, normalizing formatting in text, or any repetitive substitution that would otherwise require manual editing.
Preview mode highlights every match in the source so you can verify the pattern does what you expect before committing. Per-match replace lets you skip specific instances if the pattern is too broad. Regex mode exposes the full JavaScript regex engine — capture groups, lookaheads, and back-references all work. Case-sensitive matching preserves the original case in replacements when combined with capture groups. Multi-line mode makes ^ and $ match line boundaries, and s-flag makes . match newlines. Everything runs in the browser with no upload, so you can use the tool on confidential content without privacy worry.
Find and Replace — key features
Plain and regex modes
Choose literal text match for simple replacements, or full regex for pattern-based transformations.
Case sensitivity control
Toggle case-insensitive matching when you want to find variants like ERROR, Error, and error together.
Whole word matching
Match only at word boundaries so replacing "cat" does not affect "catalog" or "concatenate".
Multi-line and dotall
Toggle flags to make ^ and $ match per line or to make . match newlines for cross-line patterns.
Preview before replace
Highlights every match in the source text and shows the proposed replacement — nothing is changed until you confirm.
Selective replacement
Uncheck specific matches to skip them, useful when the pattern accidentally matches a few cases you want to keep.
Back-reference support
Use $1, $2 in the replacement to reorder or transform captured groups for sophisticated text rewriting.
Runs entirely in browser
Confidential content stays local — no upload, no server, no logging.
How to use the Find and Replace
- 1
Paste your source text
Drop the text you want to modify into the input field. Any size from a paragraph to a full document works.
- 2
Enter find and replace patterns
Type the text or regex to find, then the replacement to use. Pick plain or regex mode.
- 3
Set match options
Toggle case-insensitive, whole-word, multi-line, or dotall flags depending on what you want to match.
- 4
Preview matches
The tool highlights every match and shows the replacement. Uncheck any false positives before applying.
- 5
Apply and copy
Click replace to apply the changes, then copy the result to clipboard for paste into your target location.
Common use cases for the Find and Replace
Code refactoring
- →Variable renaming: Rename a variable across a file with whole-word matching to avoid touching partial matches like userId vs userIdentity.
- →API endpoint migration: Update API paths across documentation or tests when an endpoint changes (/api/v1/ → /api/v2/).
- →Import path updates: Rewrite module import paths en masse when moving files within a project.
Content editing
- →Branding changes: Replace product names, URLs, or contact information across articles, docs, or landing pages.
- →Style normalization: Standardize punctuation (straight quotes to curly), spacing, or hyphenation across a document.
- →Glossary application: Wrap defined terms in links or tags throughout a large document using regex with back-references.
Data cleaning
- →CSV value normalization: Convert inconsistent values (Y/Yes/yes → true) across thousands of rows before import.
- →Log redaction: Replace email addresses, IPs, or tokens with placeholder values before sharing logs publicly.
- →Whitespace cleanup: Collapse multiple spaces to single, remove trailing spaces, or convert tabs to spaces.
Find and Replace — examples
Simple text replace
Change one word to another across a paragraph.
find: tooleras replace: Tooleras Pro text: tooleras is great, tooleras works
Tooleras Pro is great, Tooleras Pro works
Case-insensitive
Match all variants with the i flag.
find: error (case insensitive) replace: ERROR text: Error or error or ERROR or eRrOr
ERROR or ERROR or ERROR or ERROR
Whole word
Replace only complete words, not substrings.
find: cat (whole word) replace: dog text: cat cats catalog cat-like
dog cats catalog dog-like
Regex with back-reference
Swap first and last name using capture groups.
find: (\\w+) (\\w+) (regex) replace: $2 $1 text: Ana Kowalski
Kowalski Ana
Multi-line
Remove trailing whitespace on every line.
find: [ \\t]+$ (regex, multiline) replace: (empty) text: line1 \nline2\t\n
line1\nline2\n
Technical details
Find-and-replace operations have three control dimensions: match pattern, match options, and replacement semantics.
The match pattern can be plain text or a JavaScript-compatible regex. Plain mode escapes special regex characters (dot, brackets, parentheses) so you find exactly the literal string. Regex mode treats the pattern as a regular expression — powerful but requires familiarity with regex syntax.
Match options include case sensitivity (i flag), global (g flag, replace all occurrences; without it, only the first), multi-line (m flag, makes ^ and $ match line boundaries not just string boundaries), dotall (s flag, makes . match newlines), Unicode (u flag, proper handling of surrogate pairs and Unicode property escapes), and whole-word (adds \\b boundaries around the pattern automatically in non-regex mode).
Replacement semantics support back-references in regex mode: $1 refers to the first capture group, $2 to the second, etc. $& refers to the entire match. This lets you reorder captured groups (swap first and last name: s/(\\w+) (\\w+)/$2 $1/) or transform text while preserving parts.
Preview before commit shows all matches highlighted, the current and proposed replacement for each, and a summary count. The user can uncheck specific matches to skip them. This is particularly valuable for broad patterns where false positives are likely.
Performance: regex operations on multi-megabyte text can stall the browser if the pattern is poorly designed. The tool times out excessively slow patterns (regex engines are vulnerable to \"catastrophic backtracking\" for certain input-pattern combinations) with a warning to refactor the pattern.
Line-ending normalization: Windows text uses \\r\\n, Unix uses \\n. A pattern matching \\n will not match \\r\\n endings. The tool normalizes to \\n internally for matching and restores original endings on output unless you explicitly want them changed.
Common problems and solutions
⚠Special regex characters in plain mode
Characters like . ? + * ( ) [ ] have special meaning in regex. Plain mode escapes them automatically. If you switch to regex mode with a pattern containing these characters, escape them with backslash or quote them.
⚠Greedy vs lazy matching
Regex quantifiers like .* are greedy by default — they match as much as possible. Add ? to make them lazy: .*? matches as little as possible. Use lazy matching when you want shortest match (e.g., matching HTML tags).
⚠Catastrophic backtracking
Certain regex patterns like (a+)+ on long inputs cause exponential runtime. If the tool reports a timeout, refactor the pattern using possessive quantifiers or atomic groups (not fully supported in JS regex, but alternate formulations work).
⚠Unicode surrogate handling
Emoji and non-BMP characters use surrogate pairs in JavaScript strings. Without the u flag, regex treats each half separately. Always enable Unicode mode when working with text that may contain emoji or Asian characters.
⚠Back-reference in plain mode
$1 and $2 are only meaningful in regex mode with capture groups. In plain mode, $1 is just the literal string $1. Switch to regex mode to use back-references.
⚠Line ending differences
Windows \r\n vs Unix \n causes patterns to fail on the wrong-endings text. The tool normalizes internally, but exported output preserves the original endings. Check line-ending format if results look wrong.
⚠Global flag or not
Without the g flag (which the tool sets by default), only the first match is replaced. If you want just the first replacement, unset the global flag; otherwise the default behavior replaces all.
Find and Replace — comparisons and alternatives
Compared to text editor find-and-replace (VS Code, Sublime, Notepad++), this tool works on pasted content without opening a file, offers preview mode, and handles large bulk operations without modifying the editor state. Editors are better for in-place editing of files you have open; this tool is for ad-hoc text transformations.
Compared to Unix sed, this tool has a friendlier UI and preview, but less scripting power. sed is ideal for pipelines and batch processing; this tool is ideal for interactive, one-off transformations.
Compared to spreadsheet Find and Replace, this tool handles multi-line text and regex, which spreadsheets often don\u2019t. For tabular data dedup and replacement, spreadsheets work well; for prose or code, this tool wins.
Frequently asked questions about the Find and Replace
▶How do I replace all occurrences of a word in text?
Paste your text, enter the word to find, enter the replacement, and click replace. Make sure global mode is enabled (default). For case-insensitive matching, enable the case-insensitive option so Cat, cat, and CAT are all replaced.
▶What is the difference between plain text and regex mode?
Plain text mode treats your find pattern as literal — special characters like dots and parentheses are escaped automatically. Regex mode treats the find pattern as a regular expression, allowing patterns like \\d+ (one or more digits) or (cat|dog) (cat or dog). Use plain for simple substitutions, regex for pattern-based transformations.
▶How do I replace whole words only?
Enable the whole-word option. This adds word-boundary markers (\\b in regex) around your find pattern so it only matches complete words. Replacing "cat" with whole-word enabled does not affect "catalog" or "concatenate".
▶Can I use regex capture groups for complex replacements?
Yes. In regex mode, parentheses capture groups you can reference in the replacement with $1, $2, etc. Example: find (\\w+) (\\w+) and replace with $2 $1 swaps the first and second word of each match.
▶How do I replace newlines or multi-line patterns?
Enable multi-line mode so ^ and $ match line boundaries, or enable dotall mode so . matches newlines too. For matching explicit newlines, use \\n (or \\r\\n for Windows files) in regex mode.
▶Is my text uploaded to a server?
No. All matching and replacement runs entirely in your browser using JavaScript. Sensitive text — contracts, code, private data — never leaves your machine, which matters for regulated content and internal-only documents.
▶Can I preview before committing?
Yes. The tool highlights every match in your source text and shows the replacement for each. If a match is a false positive, uncheck it before applying. This prevents accidental replacements that would be hard to undo on large documents.
▶How large a text can I process?
Up to several megabytes works smoothly in modern browsers. Beyond that, regex operations may slow the tab. For truly large files, process in chunks or use a command-line tool like sed or perl designed for stream processing.
Additional resources
- MDN Regular Expressions — Comprehensive MDN guide to JavaScript regex syntax and methods.
- regex101.com — Interactive regex tester and debugger for building patterns.
- GNU sed manual — Command-line text stream editor, the CLI alternative for bulk replacement.
- ECMAScript regex reference — Authoritative JavaScript regex specification, which this tool follows.
- Regex Crossword — Playful way to practice regex patterns with puzzles of increasing difficulty.
Related tools
All Text ToolsCase Converter
Convert between upper, lower, title, camel, snake, kebab, Pascal, CONSTANT cases
Line Counter
Count lines in text with separate totals for blank lines, non-blank lines, words, characters, and paragraphs for detailed statistics.
Regex Tester
Test and debug regular expressions with live matching and explanation
Remove Duplicate Lines
Remove duplicate lines from text with case-sensitive or case-insensitive matching, preserving original order or sorting the result.
Remove Line Breaks
Remove line breaks from text, convert to spaces, or keep paragraph breaks while flattening unwanted newlines.
Sort Lines
Sort text lines alphabetically, numerically, by length, randomly, or in reverse, with options for case sensitivity and duplicate removal.
Learn more
Explore more tools
200+ free tools that run in your browser.
Browse all tools →