Regex Find & Replace — Regular Expression Text Tool
Use the full power of regular expressions to find and replace complex text patterns. Our regex find and replace tool supports JavaScript regex syntax including groups, backreferences, lookaheads, and all standard flags — all in your browser.
Tips
Use capture groups for smart replacements
Wrap parts of your pattern in () to capture groups. Reference them in the replacement as $1, $2, etc. Example: find (\w+)@(\w+) and replace with $2/$1 to swap email parts.
The g flag replaces all matches
Without the global (g) flag, only the first match is replaced. Always use /pattern/g for bulk replacements.
Test your regex first
Before running on a large document, test your regex pattern on a small sample. Check that it matches what you intend and nothing else.
Escape special characters
In regex, characters like . * + ? ( ) [ ] { } ^ $ | \ have special meanings. To match them literally, escape with a backslash: \. matches a period, not any character.
Find & Replace
ContentFind and replace text in large blocks with regex support and real-time preview.
About this tool
What is Find & Replace?
The Find & Replace tool lets you search for any word, phrase, or pattern in a block of text and replace every occurrence — or specific instances — with something else. It supports plain text matching, case-sensitive search, and regular expressions for pattern-based replacements, with a diff view to visualize exactly what changed.
It's useful for bulk editing documents, cleaning up logs, refactoring code snippets, standardizing terminology across content, or testing a regex replacement before running it programmatically.
How to Use Find & Replace
- Paste your text into the input editor. Any plain text content works: documents, code, logs, CSV data, email templates, whatever you need to edit.
- Enter your search term — the word, phrase, or regex pattern you want to find.
- Enter the replacement — what you want to substitute in. Leave it empty to delete every match.
- Toggle options as needed: case-sensitive matching, whole-word matching, or regex mode.
- Apply the replacement. Use Replace All to swap every match at once, or step through matches one at a time with Replace Next.
- Check the diff view to see added and removed text highlighted line by line before copying.
- Copy the result or undo and adjust if something wasn't right.
Options Explained
Case sensitive — when enabled, Error and error are treated as different strings. Disabled by default, so searches match regardless of capitalization.
Whole word — when enabled, searching for log won't match logger or catalog. The match must be a complete word bounded by whitespace or punctuation.
Regular expressions (regex) — when enabled, the search field accepts a JavaScript regex pattern. This unlocks pattern matching: find all lines starting with a word, match email addresses, replace strings with a specific structure, and so on.
Using Regex Replacements
Regular expressions let you match patterns rather than fixed strings, and capture parts of the match to reuse in the replacement.
Capture groups — wrap part of the pattern in () to capture it. Reference captured groups in the replacement with $1, $2, etc.
Example: swap the order of a first last name to last, first:
- Find:
(\w+)\s+(\w+) - Replace:
$2, $1 John Smith→Smith, John
Common patterns:
\d+— one or more digits\b— word boundary (use for whole-word matching in regex mode)^— start of a line.*— any characters (greedy)[A-Z]— any uppercase letter
Diff View
After applying a replacement, switching to diff view shows the before and after side by side, with:
- Green lines — content that was added or changed to
- Red lines — content that was removed or changed from
- Neutral lines — unchanged content
This makes it easy to confirm that only the intended text changed, and nothing else was accidentally affected — especially important when using regex patterns.
Privacy
All text processing — including regex evaluation and diff generation — happens entirely in your browser. No content is sent to any server or stored between sessions.
Discussion
Join the discussion
Sign in to share your thoughts and engage with the community.