Advanced Find & Replace

Simple text, regex with capture groups, multi-rule batch replace, and diff preview. All in your browser.

Input Text
Output
Enter find text and paste your content to begin.

How to Use Advanced Find & Replace

  1. Choose a mode — Simple for plain text, Regex for pattern matching, Multi-Rule for batch replacements, or Preview to see a diff before applying.
  2. Enter your find pattern and replacement text in the fields above the input area.
  3. Paste your text into the left panel. Replacements apply automatically.
  4. Review the output on the right or see the highlighted diff in Preview mode.
  5. Copy or download the result using the buttons above the output.

Mode Details

Simple Mode

Finds all occurrences of plain text and replaces them. By default, case-sensitive. Enable "Case Sensitive" to force exact case matching. Enable "Whole Word Only" to match only when the pattern appears as a complete word (surrounded by word boundaries, not within a longer word). Leave the Replace field empty to delete all matches.

Regex Mode

Full regular expression support using JavaScript's RegExp engine. The find field accepts a regex pattern. Use capture groups (group) and backreferences $1, $2 in the replacement. For example, to swap first and last name: find (\w+)\s+(\w+) and replace with $2, $1. All replacements are global (replace all matches). Special replacement patterns like $$ (literal $), $& (whole match), $` (before match), $' (after match) are all supported.

Multi-Rule Mode

Define multiple find/replace pairs as a JSON array. Each rule is ["find", "replace"]. Rules are applied in order — the output of each rule becomes the input of the next. This allows chaining transformations: first normalize line endings, then replace all URLs, then clean up whitespace. Rules in Multi-Rule mode are treated as plain text (not regex). For regex batch rules, switch to Regex mode and apply one at a time.

Preview / Diff Mode

Shows a word-level diff highlighting what will be removed (red, strikethrough) and what will be added (green). Use this mode to verify complex regex replacements before committing. The diff uses a simple token-based comparison of lines, so changes are shown in context. This is especially useful when working with large texts where a wrong replacement could be hard to spot in the plain output.

Regex Reference

  • \d — digit, \w — word character, \s — whitespace
  • . — any character (except newline without dot-all), * — zero or more, + — one or more
  • ^ — start of line (with multiline flag), $ — end of line
  • (group) — capture group, (?:group) — non-capturing group
  • $1, $2 — backreferences in replacement
  • [abc] — character class, [^abc] — negated class
  • \b — word boundary, | — alternation (OR)

Frequently Asked Questions

In Regex mode, use parentheses in your find pattern to create capture groups: (\w+). Then reference them in the replacement using $1, $2, etc. For example, find '(\w+)\s+(\w+)' and replace with '$2 $1' to swap two words. Backreferences work the same as in most regex engines.
Multi-Rule mode lets you define multiple find/replace pairs and apply them all at once in a single pass. Each rule is entered as a JSON array of [find, replace] pairs. Rules are applied in order from top to bottom. This is useful for batch-renaming variables, applying multiple text substitutions, or transforming data formats.
Preview mode shows a color-coded diff of the changes before they are applied. Removed text appears in red, added text appears in green. This lets you verify that your find and replace rules are correct before committing to the changes. Preview mode is especially useful for complex regex replacements.
Yes. In Simple mode, leave the "Case Sensitive" checkbox unchecked (it is off by default). In Regex mode, the "Case Insensitive" checkbox adds the 'i' flag to your pattern. In Multi-Rule mode, use the "Case Insensitive" checkbox that appears in that panel.
Since everything runs in your browser, the limit depends on available memory. The tool handles texts up to several megabytes without issues. For very large files (10MB+), consider using command-line tools like sed or awk which can stream files without loading them entirely into memory.