Find and Replace in Text Online
Search and replace words, phrases, or Regular Expressions (Regex) across large blocks of text. View match counts in real time and replace with a single click.
Batch Find & Replace Text Online
Updating repeated terms across articles, logs, transcripts, or code blocks can be tedious and prone to typos. The Find and Replace tool lets you search for specific keywords, phrases, or flexible Regular Expressions (regex) and substitute them across your entire text with one click.
Because all operations run entirely within your web browser using client-side JavaScript, your text remains completely private — no data is ever uploaded or saved on external servers.
Search Modes Explained
- Plain Text Search: Replaces literal text matches. Special characters like dots, brackets, and question marks are treated as ordinary text.
- Case Sensitive: Differentiates between uppercase and lowercase letters (e.g. searching for "Cat" will leave "cat" untouched).
- Whole Words Only: Uses word boundaries (
\b) so that matching "art" won't mistakenly modify words like "start", "party", or "article". - Regular Expression (Regex): Unlocks pattern matching, wildcards, character sets, and capture group substitutions using standard JavaScript regex syntax.
Common Regular Expression (Regex) Examples
When the Regular Expression (Regex) option is enabled, you can use these tested patterns to quickly automate text cleaning and data formatting:
| Goal | Find Pattern (Regex) | Replace With | How It Works |
|---|---|---|---|
| Remove HTML / XML Tags | <[^>]+> | (leave empty) | Matches anything between angle brackets, stripping out HTML elements while keeping inner text. |
| Normalize Multiple Spaces | [ \t]+ | (single space) | Collapses repeated spaces and tabs into a single clean space. |
| Delete Empty / Blank Lines | ^\s*[\r\n] | (leave empty) | Removes lines that contain only whitespace or empty line breaks. |
| Match & Redact Emails | \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]\b | [email] | Finds email addresses conforming to standard username and domain structures. |
| Remove All Numbers / Digits | \d+ | (leave empty) | Matches any integer numbers (0–9) and deletes them. |
| Remove Non-Alphanumeric Chars | [^a-zA-Z0-9\s] | (leave empty) | Strips punctuation and special symbols while preserving letters, numbers, and spaces. |
| Trim Line-Leading Numbers | ^\s*\d+[\.\)]\s* | (leave empty) | Strips numbering prefixes like "1. " or "2) " from the start of each line. |
| Swap Word Order (Capture Groups) | (\w+)\s+(\w+) | $2, $1 | Captures two adjacent words and rearranges them (e.g. "John Smith" → "Smith, John"). |
| Match Web URLs | https?:\/\/[^\s]+ | [link] | Matches links starting with http:// or https:// up to the next space. |
Using Capture Groups in Replacements
In Regular Expression mode, you can wrap parts of your search pattern in parentheses (...) to create capture groups. In the Replace with field, refer to captured groups using $1 for the first group, $2 for the second group, and so on. For example, finding (\d)-(\d)-(\d) and replacing with $2/$3/$1 converts ISO dates (YYYY-MM-DD) into US format (MM/DD/YYYY).
Related Text Tools
Explore more text processing utilities on ezgif:
- Clean Whitespace — quickly strip extra spaces, fix tab indents, and format paragraphs.
- Remove Duplicate Lines — eliminate repetitive lines or find unique entries.
- Remove Empty Lines — strip blank lines from text or collapse consecutive breaks.
- Case Converter — transform text between uppercase, lowercase, title case, and code formats.
- Compare Text (Diff Checker) — view additions and deletions side-by-side between two text versions.
- Character Counter — count characters, words, sentences, and calculate reading time.