Search...Search plugins and themes...
⌘K
Sign in
  • Get started
  • Download
  • Pricing
  • Enterprise
  • Account
  • Obsidian
  • Overview
  • Sync
  • Publish
  • Canvas
  • Mobile
  • Web Clipper
  • CLI
  • Learn
  • Help
  • Developers
  • Changelog
  • About
  • Roadmap
  • Blog
  • Resources
  • System status
  • License overview
  • Terms of service
  • Privacy policy
  • Security
  • Community
  • Plugins
  • Join the community
  • Discord
  • Forum / 中文论坛
  • Merch store
  • Brand guidelines
Follow us
DiscordTwitterBlueskyThreadsMastodonYouTubeGitHub
© 2026 Obsidian

Better Search and Replace

saltyfireballsaltyfireball66 downloads

Enhanced search and replace with regex support, live diff preview, capture groups, and a floating editor bar.

Add to Obsidian
  • Overview
  • Scorecard
  • Updates2

An enhanced search and replace plugin for Obsidian. Provides a floating search bar docked to the top of the editor with live highlighting, real-time diff preview, regex support with capture groups, and more.

Works on both desktop and mobile.

Features

  • Floating search bar -- slides in at the top of the editor (not a modal, not a sidebar)
  • Real-time match highlighting -- matches are highlighted as you type
  • Live diff preview -- matched text is shown with strikethrough (red) and the replacement is shown as green ghost text inline, so you can see exactly what will change before committing
  • Regular expression support -- full JavaScript regex with capture groups ($1, $2, $<name>)
  • Case sensitive toggle -- match exact case or ignore case
  • Whole word toggle -- restrict matches to whole words only
  • Match counter -- shows "3 of 12" style count inline with the search field
  • Match navigation -- step through matches one at a time with up/down arrows
  • Replace current -- replace just the current match
  • Replace all -- replace every match at once
  • Regex validation -- invalid regex patterns are caught immediately with inline error messages
  • Capture group hint -- when regex mode is on, a hint reminds you that $1, $2, $<name> are available
  • Customizable colors -- match highlight, current match, strikethrough, and preview colors are all configurable in settings
  • Keyboard shortcuts -- Enter/Shift+Enter to navigate, Escape to close, Enter in replace field to replace current, Shift+Enter to replace all
  • Command palette integration -- open via "Better Search and Replace: Find and replace in current file"
  • Hotkey support -- assign any shortcut (e.g. Cmd/Ctrl+F) to replace the built-in search
  • Note toolbar integration -- accessible from the helpers modal when the note-toolbar plugin is installed

How to Use

  1. Open the command palette and run Better Search and Replace: Find and replace in current file
  2. Type your search query in the search field
  3. Matches are highlighted in the editor in real time
  4. Use the toggle buttons to enable:
    • .* Regex mode
    • Aa Case sensitivity
    • W Whole word matching
  5. Type replacement text in the replace field to see a live diff preview
  6. Click Replace to replace the current match, or Replace All to replace every match
  7. Press Escape or click the X button to close the search bar

Setting Up a Keyboard Shortcut

To replace Obsidian's built-in Cmd/Ctrl+F with this plugin:

  1. Go to Settings > Hotkeys
  2. Search for "Better Search and Replace: Find and replace in current file"
  3. Click the + button and press your desired key combination (e.g. Cmd/Ctrl+F)
  4. If the shortcut conflicts with the built-in search, Obsidian will prompt you to remove the existing binding

Regex Capture Groups

When regex mode is enabled, you can use standard JavaScript replacement patterns in the replace field:

Pattern Meaning
$1, $2, ... Capture group 1, 2, etc.
$<name> Named capture group ((?<name>...))
$& The entire matched substring
$` Text before the match
$' Text after the match
$$ A literal $

Installation

Obsidian Community Plugin (pending)

This plugin has been submitted for review to the Obsidian community plugin directory. Once approved, you will be able to install it directly from Settings > Community plugins > Browse by searching for "Better Search and Replace".

Using BRAT

You can install this plugin right now using the BRAT plugin:

  1. Install BRAT from Settings > Community plugins > Browse (search for "BRAT" by TfTHacker)

  2. Open the BRAT settings

  3. Under the Beta plugins section, click Add beta plugin

    BRAT beta plugin list

  4. In the overlay, enter this plugin's repository: https://github.com/saltyfireball/obsidian-better-search-and-replace (or just saltyfireball/obsidian-better-search-and-replace)

    BRAT add beta plugin

  5. Leave the version set to latest

    BRAT beta plugin filled

  6. Click Add plugin

Manual

  1. Download the latest release from the Releases page
  2. Copy main.js, manifest.json, and styles.css into your vault's .obsidian/plugins/sfb-better-search-and-replace/ directory
  3. Enable the plugin in Settings > Community plugins

Settings

  • Default search options -- set whether regex, case sensitivity, and whole word matching are on by default
  • Match highlight color -- background color for matched text
  • Match strikethrough color -- color of the strikethrough line on matches when replacement is shown
  • Replacement preview color -- background color for the ghost replacement text
  • Current match highlight color -- background color for the currently selected match

Default colors use the Monokai Pro palette:

  • Match: Red (#FF6188) at 25% opacity
  • Current match: Yellow (#FFD866) at 35% opacity
  • Preview: Green (#A9DC76) at 25% opacity

License

MIT

84%
HealthExcellent
ReviewCaution
About
Add a floating search bar docked to the top of the editor with live match highlighting and a real-time inline diff preview showing strikethrough removals and green replacement ghost text. Use full JavaScript regex with capture groups, step through matches, and replace the current match or all matches on desktop and mobile.
SearchEditingInterface
Details
Current version
1.0.9
Last updated
15 hours ago
Created
2 months ago
Updates
2 releases
Downloads
66
Compatible with
Obsidian 1.0.0+
License
MIT
Report bugRequest featureReport plugin
Author
saltyfireballsaltyfireball
GitHubsaltyfireball
  1. Community
  2. Plugins
  3. Search
  4. Better Search and Replace

Related plugins

Meta Bind

Make your notes interactive with inline input fields, metadata displays, and buttons.

Hover Editor

Transform the Page Preview hover popover into a fully working editor instance.

Floating Search

Search text by using Obsidian default search view.

Feed Bases

Adds a feed layout to bases so you can display notes with their content in an editable feed view.

Dragger

Drag and drop any block (paragraphs, headings, lists, etc.) to rearrange content like Notion.

Slash Commander

Customize the slash command list, assign each command an icon.

Better Search Views

Upgrade global search, backlinks and queries with outliner-like context trees.

Lineage

A writing interface that combines structure and content. Inspired by Gingko Writer.

Advanced Tables

Improved table navigation, formatting, and manipulation.

Hider

Hide interface elements such as tooltips, status bar, titlebar, and more.