---
title: Search and Replace with Regex | Prettify Docs
description: Find text in the Tree, Table, or Raw view with plain text or a
  regular expression. Replace one match or every match. Free in Prettify.
url: https://prettify.tools/docs/search-and-replace
---

[Docs](https://prettify.tools/docs) / Editing tools

# Search and replace

Last updated: October 16, 2026

Search and replace finds text in the open document and changes it. It works in the Tree, Table, and Raw views, with plain text or a regular expression. Search and replace is free in [Prettify](https://prettify.tools/app/editor).

## Open the search bar

Load a document first. Search is available once data is present.

- Press `Cmd+F` (Mac) / `Ctrl+F` (Windows, Linux) to open search.
- Press `Cmd+H` (Mac) / `Ctrl+H` (Windows, Linux) to open search with the replace row expanded. On the Mac desktop app, `Cmd+H` hides the app, so press `Cmd+Option+F` there.
- Click the chevron at the left of the search bar to show or hide the replace row.
- Press `Esc` to close the search bar.

The bar shows the active match and the total count, for example `3/12`. It shows `No results` when nothing matches.

## Set search options

Two toggles sit next to the search field.

| Toggle         | Button | What it does                                       |
| -------------- | ------ | -------------------------------------------------- |
| Case sensitive | `Aa`   | Match the exact letter case. Off by default.       |
| Regex          | `.*`   | Read the query as a JavaScript regular expression. |

In regex mode, Prettify uses standard JavaScript regular expression syntax. An invalid expression matches nothing until you fix it.

```regex
"email":\s*"[^"]+@[^"]+"
```

## Move between matches

Type a query, then step through the results.

- Press `Enter` to go to the next match.
- Press `Shift+Enter` to go to the previous match.
- Click the up and down arrows to do the same.

Search highlights every match in the current view and scrolls the active match into view.

## Replace text

Open the replace row, then type a replacement.

1. Type the text to find in the search field.
2. Type the new text in the replace field.
3. Press `Enter`, or click the Replace button, to replace the active match.
4. Press `Shift+Enter`, or click Replace All, to replace every match.

The Replace All button shows the number of matches it will change.

Replace edits the document text, so it runs the same way in every view. In regex mode, the replacement can use `$1` for a capture group.

Prettify checks the result before it applies a replacement. If the change would make the document invalid, Prettify keeps the document and shows the message `Replace would break format`.

## Search in each view

Search runs against the view you are in.

- Tree view matches keys and values.
- Table view matches cell values and column names, and highlights the matching rows.
- Raw view matches whole lines.

The match count can differ between views because each view counts different units: nodes, rows, or lines.

## Keep a search in the URL

The left pane stores the search state in the page URL, so you can share or bookmark a search. These query parameters control it.

| Parameter | Meaning                           |
| --------- | --------------------------------- |
| `q`       | The search text.                  |
| `regex`   | `true` turns on regex mode.       |
| `cs`      | `true` turns on case sensitivity. |
| `si`      | The index of the active match.    |

## Related

- [Views: Tree, Table, Raw, and More](https://prettify.tools/docs/views)
- [jq queries](https://prettify.tools/docs/jq) for structural filters on JSON
- [Keyboard shortcuts](https://prettify.tools/docs/keyboard-shortcuts)

## Try it online

Tool pages for this topic. Each one runs in your browser.

- [JSON Editor](https://prettify.tools/json-editor)
- [How to Edit JSON](https://prettify.tools/how-to-edit-a-json-file)

* [PreviousXPath queries](https://prettify.tools/docs/xpath)
* [Next Format conversion](https://prettify.tools/docs/conversion)

## Structured data

```json
{
  "@context": "https://schema.org",
  "@type": "SoftwareApplication",
  "name": "Prettify",
  "url": "https://prettify.tools",
  "description": "Multi-format data viewer, editor, and query engine for JSON, YAML, CSV, XML, Mermaid, Markdown, MDX, HTML, and SVG",
  "applicationCategory": "DeveloperApplication",
  "operatingSystem": "Web, macOS, Windows, Linux",
  "offers": [
    {
      "@type": "Offer",
      "price": "0",
      "priceCurrency": "USD",
      "description": "Free tier with core features"
    },
    {
      "@type": "Offer",
      "price": "19.99",
      "priceCurrency": "USD",
      "description": "Pro: lifetime access to all features"
    }
  ],
  "publisher": {
    "@id": "https://prettify.tools/#organization"
  }
}
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "@id": "https://prettify.tools/#organization",
  "name": "Prettify",
  "legalName": "Off Leash Labs",
  "url": "https://prettify.tools/",
  "logo": {
    "@type": "ImageObject",
    "url": "https://prettify.tools/icon-512.png",
    "width": 512,
    "height": 512
  },
  "contactPoint": {
    "@type": "ContactPoint",
    "contactType": "customer support",
    "email": "offleashlabs@gmail.com",
    "availableLanguage": "English"
  }
}
```
