Search and Replace - Free Online Tool | PivaBox

Search and replace text with optional regex support and match counting

Search and Replace Tool — Find and Replace Text with Real-Time Match Counting, Regex Support, Capture Group Substitution, and Case-Sensitive Options

  1. Paste or type your source text into the input textarea — this accepts any text from short snippets to multi-megabyte documents. The Search and Replace tool is designed for precision text transformation tasks: cleaning up data exports (replacing inconsistent delimiters), refactoring code (renaming variables across a file), formatting documents (standardizing date formats, phone number patterns), and bulk editing (replacing company names, URLs, or terminology across large text corpora). Unlike find-and-replace in text editors, this tool shows all match statistics before you commit to the replacement, giving you confidence that your pattern matches exactly what you intend.
  2. Enter your search pattern and replacement text in the respective fields. For basic text: enter literal strings for exact matching — the tool counts occurrences and replaces them (case-sensitive or case-insensitive, toggle-able). For advanced pattern matching: enable Regex mode to use regular expressions. In regex mode, you get access to the full JavaScript regex engine: capture groups — use parentheses (...) to capture matched substrings and reference them in the replacement with
    , , etc. (e.g., replace (\d{4})-(\d{2})-(\d{2}) with /$3/
    to convert YYYY-MM-DD dates to MM/DD/YYYY format), character classes ([aeiou], \d, \w, \s), quantifiers (*+?{n,m}), word boundaries (\b prevents partial-word matches), and regex flags (g global, i case-insensitive, m multiline where ^ $ match line boundaries).
  3. Review the real-time feedback as you type: the match count shows how many occurrences were found (turns red if zero matches, reassuring you the pattern is working), and the result preview below shows the transformed text with all replacements applied and changes visually highlighted. This instant feedback loop lets you iterate on your search pattern until you see exactly the matches and replacements you want. Click Copy to transfer the transformed text to your clipboard. Common use cases: reformatting CSV/TSV data, cleaning up OCR text with systematic errors, batch-renaming identifiers in configuration files, standardizing phone number or address formats, and removing or replacing sensitive information patterns (PII redaction). All processing happens in your browser — your text data, which may contain proprietary or sensitive information, never leaves your device.

Frequently Asked Questions

How do capture groups work in regex replacement, and what are some practical examples?

Capture groups are the most powerful feature of regex replacement — they let you extract parts of a match and rearrange them in the replacement. A capture group is created with parentheses <code>(...)</code> in your search pattern. Each group captures the substring that matches the pattern inside the parentheses, numbered from left to right starting at 1. In the replacement string, <code>

</code> inserts the content of group 1, <code> </code> for group 2, etc. <code>

PivaBox - Free Online Browser Tools

265+ free online tools for image processing, PDF editing, text manipulation, developer utilities, and more. All tools run entirely in your browser — your files never leave your device. Privacy-first, zero server uploads.

Image Tools

  • Image Converter — Convert images between PNG, JPEG, WebP, and AVIF
  • Image Compressor — Compress and resize images with quality control
  • Image Crop — Crop images interactively
  • Image Filter — Apply grayscale, sepia, blur, and more
  • SVG to PNG — Convert SVG vector graphics to PNG
  • Icon Generator — Generate icons from text and emoji
  • Image to Text (OCR) — Extract text from images
  • Color Picker — Pick colors from images
  • Meme Generator — Add captions to images

PDF Tools

  • PDF Image Extractor — Extract images from PDF files
  • PDF Merger — Merge multiple PDFs into one
  • PDF Splitter — Split PDFs into separate pages
  • PDF to Text — Extract text from PDF files
  • PDF Metadata — View PDF document properties

Text Tools

  • Text Diff — Compare two texts side by side
  • Markdown Preview — Write Markdown and preview HTML
  • Case Converter — Convert text case styles
  • Word Counter — Count characters, words, sentences
  • Lorem Ipsum — Generate placeholder text
  • Text Sorter — Sort, deduplicate, reverse, shuffle

Developer Tools

  • JSON Formatter — Format, validate, minify JSON
  • Regex Tester — Test regular expressions in real-time
  • UUID Generator — Generate UUID v4 identifiers
  • Hash Generator — Compute SHA-1, SHA-256, SHA-384, SHA-512
  • JWT Decoder — Decode JWT tokens
  • YAML ↔ JSON — Convert between YAML and JSON
  • Timestamp Converter — Convert Unix timestamps to dates
  • Base64 Encoder/Decoder — Encode/decode Base64
  • URL Encoder/Decoder — Encode/decode URL strings
  • Slug Generator — Convert text to URL slugs
  • Morse Code — Convert text to/from Morse code
  • Color Converter — Convert between HEX, RGB, HSL
  • Base Converter — Convert between binary, octal, decimal, hex
  • HTML Encoder/Decoder — Encode/decode HTML entities
  • JSON ↔ CSV — Convert between JSON and CSV
  • Password Generator — Generate strong passwords
  • CSS Generator — Generate box-shadow and gradient CSS
  • Cron Parser — Parse cron expressions

Other Tools

  • QR Code — Generate and decode QR codes
  • Unit Converter — Convert length, weight, temperature, area
amp;amp;</code> inserts the entire match. Practical examples: (1) <strong>Date format conversion</strong> — search: <code>(\d{4})-(\d{2})-(\d{2})</code>, replace: <code> /$3/
</code> converts '2024-03-15' → '03/15/2024'. (2) <strong>Name reordering</strong> — search: <code>(\w+),\s*(\w+)</code>, replace: <code>
</code> converts 'Doe, John' → 'John Doe'. (3) <strong>Phone number formatting</strong> — search: <code>(\d{3})(\d{3})(\d{4})</code>, replace: <code>(
) -$3</code> converts '4155551234' → '(415) 555-1234'. (4) <strong>Adding markup</strong> — search: <code>\*\*(.+?)\*\*</code>, replace: <code>&lt;strong&gt;
&lt;/strong&gt;</code> converts Markdown bold to HTML. Non-capturing groups <code>(?:...)</code> group without creating a backreference (useful when you need grouping for alternation but don't want to consume a <code>$N</code> slot). Named groups <code>(?&lt;name&gt;...)</code> allow referencing by name. The PivaBox Search &amp; Replace tool supports all of these patterns — all processing is local and private.

What's the difference between this tool and the find-and-replace feature in VS Code, Sublime Text, or other code editors?

This browser-based Search &amp; Replace tool complements editor-based find-and-replace in several ways: (1) <strong>No file system access needed</strong> — works with any text you can copy-paste, including content from web pages, PDFs, emails, and apps that don't have regex find-and-replace built in. (2) <strong>Match count at a glance</strong> — the tool prominently displays the total match count before replacement; editors typically show match counts less visibly or only after you initiate 'Find All'. (3) <strong>Preview before committing</strong> — the result preview lets you verify replacements without modifying the original file; in editors, you typically see replacements inline (which can be disorienting for large changes) or need to use a separate 'Replace All' with undo. (4) <strong>Capture group playground</strong> — the instant visual feedback makes it easier to experiment with capture group patterns and see exactly how <code>

</code>, <code> </code> resolve. (5) <strong>Privacy isolation</strong> — text stays in a browser tab with no connection to your file system; useful for one-off transformations where opening an editor and creating a temp file would be overhead. For bulk file transformations across a project, use your editor's 'Find in Files' or command-line tools like <code>sed</code>. For single-document transformations with complex regex patterns, this tool provides a focused, private workspace. All processing is client-side — your text never leaves your browser.

What regex flags are supported and how do they change matching behavior?

The tool supports the standard JavaScript regex flags that control matching behavior. <strong>g (global)</strong> — find ALL matches rather than stopping at the first match; always enable this for search-and-replace (without <code>g</code>, only the first occurrence gets replaced). <strong>i (case-insensitive)</strong> — <code>[a-z]</code> also matches <code>[A-Z]</code> and vice versa; useful when you want to match regardless of capitalization but preserves the original case in the replacement. <strong>m (multiline)</strong> — changes <code>^</code> and <code>

PivaBox - Free Online Browser Tools

265+ free online tools for image processing, PDF editing, text manipulation, developer utilities, and more. All tools run entirely in your browser — your files never leave your device. Privacy-first, zero server uploads.

Image Tools

  • Image Converter — Convert images between PNG, JPEG, WebP, and AVIF
  • Image Compressor — Compress and resize images with quality control
  • Image Crop — Crop images interactively
  • Image Filter — Apply grayscale, sepia, blur, and more
  • SVG to PNG — Convert SVG vector graphics to PNG
  • Icon Generator — Generate icons from text and emoji
  • Image to Text (OCR) — Extract text from images
  • Color Picker — Pick colors from images
  • Meme Generator — Add captions to images

PDF Tools

  • PDF Image Extractor — Extract images from PDF files
  • PDF Merger — Merge multiple PDFs into one
  • PDF Splitter — Split PDFs into separate pages
  • PDF to Text — Extract text from PDF files
  • PDF Metadata — View PDF document properties

Text Tools

  • Text Diff — Compare two texts side by side
  • Markdown Preview — Write Markdown and preview HTML
  • Case Converter — Convert text case styles
  • Word Counter — Count characters, words, sentences
  • Lorem Ipsum — Generate placeholder text
  • Text Sorter — Sort, deduplicate, reverse, shuffle

Developer Tools

  • JSON Formatter — Format, validate, minify JSON
  • Regex Tester — Test regular expressions in real-time
  • UUID Generator — Generate UUID v4 identifiers
  • Hash Generator — Compute SHA-1, SHA-256, SHA-384, SHA-512
  • JWT Decoder — Decode JWT tokens
  • YAML ↔ JSON — Convert between YAML and JSON
  • Timestamp Converter — Convert Unix timestamps to dates
  • Base64 Encoder/Decoder — Encode/decode Base64
  • URL Encoder/Decoder — Encode/decode URL strings
  • Slug Generator — Convert text to URL slugs
  • Morse Code — Convert text to/from Morse code
  • Color Converter — Convert between HEX, RGB, HSL
  • Base Converter — Convert between binary, octal, decimal, hex
  • HTML Encoder/Decoder — Encode/decode HTML entities
  • JSON ↔ CSV — Convert between JSON and CSV
  • Password Generator — Generate strong passwords
  • CSS Generator — Generate box-shadow and gradient CSS
  • Cron Parser — Parse cron expressions

Other Tools

  • QR Code — Generate and decode QR codes
  • Unit Converter — Convert length, weight, temperature, area
lt;/code> from matching start/end of the entire string to matching start/end of each line; essential when searching line-by-line (e.g., finding lines that start with a specific pattern). <strong>s (dotall)</strong> — makes <code>.</code> match newline characters (<code>\n</code>) in addition to all other characters; useful when you need a pattern to span multiple lines. <strong>u (unicode)</strong> — enables full Unicode support including surrogate pair handling and Unicode property escapes (<code>\p{Letter}</code>, <code>\p{Emoji}</code>); essential when working with non-ASCII text. For example, to remove all lines starting with 'DEBUG': use pattern <code>^DEBUG.*

PivaBox - Free Online Browser Tools

265+ free online tools for image processing, PDF editing, text manipulation, developer utilities, and more. All tools run entirely in your browser — your files never leave your device. Privacy-first, zero server uploads.

Image Tools

  • Image Converter — Convert images between PNG, JPEG, WebP, and AVIF
  • Image Compressor — Compress and resize images with quality control
  • Image Crop — Crop images interactively
  • Image Filter — Apply grayscale, sepia, blur, and more
  • SVG to PNG — Convert SVG vector graphics to PNG
  • Icon Generator — Generate icons from text and emoji
  • Image to Text (OCR) — Extract text from images
  • Color Picker — Pick colors from images
  • Meme Generator — Add captions to images

PDF Tools

  • PDF Image Extractor — Extract images from PDF files
  • PDF Merger — Merge multiple PDFs into one
  • PDF Splitter — Split PDFs into separate pages
  • PDF to Text — Extract text from PDF files
  • PDF Metadata — View PDF document properties

Text Tools

  • Text Diff — Compare two texts side by side
  • Markdown Preview — Write Markdown and preview HTML
  • Case Converter — Convert text case styles
  • Word Counter — Count characters, words, sentences
  • Lorem Ipsum — Generate placeholder text
  • Text Sorter — Sort, deduplicate, reverse, shuffle

Developer Tools

  • JSON Formatter — Format, validate, minify JSON
  • Regex Tester — Test regular expressions in real-time
  • UUID Generator — Generate UUID v4 identifiers
  • Hash Generator — Compute SHA-1, SHA-256, SHA-384, SHA-512
  • JWT Decoder — Decode JWT tokens
  • YAML ↔ JSON — Convert between YAML and JSON
  • Timestamp Converter — Convert Unix timestamps to dates
  • Base64 Encoder/Decoder — Encode/decode Base64
  • URL Encoder/Decoder — Encode/decode URL strings
  • Slug Generator — Convert text to URL slugs
  • Morse Code — Convert text to/from Morse code
  • Color Converter — Convert between HEX, RGB, HSL
  • Base Converter — Convert between binary, octal, decimal, hex
  • HTML Encoder/Decoder — Encode/decode HTML entities
  • JSON ↔ CSV — Convert between JSON and CSV
  • Password Generator — Generate strong passwords
  • CSS Generator — Generate box-shadow and gradient CSS
  • Cron Parser — Parse cron expressions

Other Tools

  • QR Code — Generate and decode QR codes
  • Unit Converter — Convert length, weight, temperature, area
lt;/code> with flags <code>gm</code> (<code>g</code> to replace all, <code>m</code> for line-by-line <code>^

PivaBox - Free Online Browser Tools

265+ free online tools for image processing, PDF editing, text manipulation, developer utilities, and more. All tools run entirely in your browser — your files never leave your device. Privacy-first, zero server uploads.

Image Tools

  • Image Converter — Convert images between PNG, JPEG, WebP, and AVIF
  • Image Compressor — Compress and resize images with quality control
  • Image Crop — Crop images interactively
  • Image Filter — Apply grayscale, sepia, blur, and more
  • SVG to PNG — Convert SVG vector graphics to PNG
  • Icon Generator — Generate icons from text and emoji
  • Image to Text (OCR) — Extract text from images
  • Color Picker — Pick colors from images
  • Meme Generator — Add captions to images

PDF Tools

  • PDF Image Extractor — Extract images from PDF files
  • PDF Merger — Merge multiple PDFs into one
  • PDF Splitter — Split PDFs into separate pages
  • PDF to Text — Extract text from PDF files
  • PDF Metadata — View PDF document properties

Text Tools

  • Text Diff — Compare two texts side by side
  • Markdown Preview — Write Markdown and preview HTML
  • Case Converter — Convert text case styles
  • Word Counter — Count characters, words, sentences
  • Lorem Ipsum — Generate placeholder text
  • Text Sorter — Sort, deduplicate, reverse, shuffle

Developer Tools

  • JSON Formatter — Format, validate, minify JSON
  • Regex Tester — Test regular expressions in real-time
  • UUID Generator — Generate UUID v4 identifiers
  • Hash Generator — Compute SHA-1, SHA-256, SHA-384, SHA-512
  • JWT Decoder — Decode JWT tokens
  • YAML ↔ JSON — Convert between YAML and JSON
  • Timestamp Converter — Convert Unix timestamps to dates
  • Base64 Encoder/Decoder — Encode/decode Base64
  • URL Encoder/Decoder — Encode/decode URL strings
  • Slug Generator — Convert text to URL slugs
  • Morse Code — Convert text to/from Morse code
  • Color Converter — Convert between HEX, RGB, HSL
  • Base Converter — Convert between binary, octal, decimal, hex
  • HTML Encoder/Decoder — Encode/decode HTML entities
  • JSON ↔ CSV — Convert between JSON and CSV
  • Password Generator — Generate strong passwords
  • CSS Generator — Generate box-shadow and gradient CSS
  • Cron Parser — Parse cron expressions

Other Tools

  • QR Code — Generate and decode QR codes
  • Unit Converter — Convert length, weight, temperature, area
lt;/code>). The PivaBox Search &amp; Replace tool makes all flags easily toggleable — all processing is local and private.