consolelog.tools

Find and Replace

Find & replace with live preview, regex flags (multiline, dotall, unicode), $1 capture groups, replace-first, and \\n / \\t escapes.

About this ToolHow it works, benefits & use cases

Find and Replace goes well past a basic search-and-swap. Enter what to find and what to replace it with, and a live preview highlights every match in the text as you type, with a running match count and a per-line match list. Plain mode supports case-sensitive matching, whole-word matching, replace-first-only, and interpreting \n and \t escapes in the replacement so you can insert real newlines and tabs. Switch on regular-expression mode to use full JavaScript regex with the multiline (^ $), dotall (. matches newline), and unicode flags, plus capture-group replacements like $1 and named groups like $<name>. Invalid patterns are reported inline instead of throwing, so you can fix them as you go. A Swap button exchanges the find and replace fields. The result downloads as a .txt file and the entire setup — text, pattern, replacement, and every option — is captured in a shareable URL. Everything runs in your browser.

How to Use

  1. 1Type the text to search for in "Find" and the replacement in "Replace with" (use "Swap" to exchange them).
  2. 2In "Options", toggle case sensitivity, whole word, replace-first-only, and \n / \t escape interpretation.
  3. 3Enable "Use regular expression" to unlock the multiline, dotall, and unicode flags and capture-group replacements.
  4. 4Paste your text into the input box, or click "Load example" — matches are highlighted live with a count.
  5. 5Click "Replace" and copy or download the result, or copy the page URL to share the exact find/replace setup.

Key Benefits

  • Live highlighted preview with a running match count and per-line match list
  • Plain or full JavaScript regular-expression matching
  • Regex flags for multiline (^ $), dotall (.), and unicode
  • Capture-group replacements with $1 and named $<name> references
  • Whole-word, case-sensitive, and replace-first-only options
  • Interpret \n and \t escapes in the replacement (literal mode)
  • Invalid regex reported inline; .txt download and a shareable URL

Common Use Cases

  • Renaming a token or variable across a pasted block of code
  • Using regex capture groups to reformat dates, IDs, or key-value pairs
  • Stripping or reformatting lines with multiline and dotall flags
  • Replacing only the first occurrence of a term while leaving the rest
  • Inserting real tabs or newlines into text via \t and \n escapes

Find & replace

Options

Literal mode only (regex uses $1)

0 characters · live

0 occurrences replaced

Enter text and a search term to see the result.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools