Search and Replace Regex

approved

by Justice Vellacott

This plugin has not been manually reviewed by Obsidian staff. A powerful regex-based search and replace tool for the app with search highlighting and navigation.

275 downloadsUpdated 7d agoMIT

Search and Replace Regex

A powerful search and replace plugin for Obsidian with full regular expression support.

Features

  • Search: Search your notes with regular expressions, plain text, or whole word matching
  • Replace: Replace single or all occurrences with support for regex capture groups
  • Search Options:
    • Case sensitive matching
    • Whole word matching
    • Regular expression mode (or plain text mode)
  • Navigation: Jump between matches with keyboard shortcuts or buttons
  • Search History: Access your recent searches and replacements
  • Match Counter: See which match you're on (e.g., "3 / 12")
  • Persistent Settings: Your default search preferences are saved

Installation

  1. Download the plugin files (main.js, manifest.json, styles.css)
  2. Place them in your vault: .obsidian/plugins/obsidian-search-replace-regex/
  3. Reload Obsidian
  4. Enable the plugin in Settings → Community plugins

Usage

Quick Start

Press Ctrl/Cmd + F (or use the command palette) to open the Search panel:

  • Type your search query (regex or plain text)
  • Use the toggle buttons to customize your search:
    • Case sensitive: Match letter casing
    • Whole word: Match only complete words
    • Use regex: Enable regular expression mode
  • Navigate matches with and buttons or press F3 for next

Replace

Press Ctrl/Cmd + H to open Search & Replace:

  • Enter your search query and replacement text
  • Click Replace & Search to replace one occurrence and move to the next
  • Click Replace All to replace all matches at once
  • Regex capture groups (like $1, $2) work in replacements

Keyboard Shortcuts

ActionShortcut
SearchCtrl/Cmd + F
ReplaceCtrl/Cmd + H
Next matchF3 or Enter
Previous matchShift + F3
Replace singleCtrl/Cmd + Enter
Replace allCtrl/Cmd + Shift + H
HistoryCtrl/Cmd +
Exit searchEsc

Search History

Access previous searches with:

  • Arrow keys in the search field to cycle through history
  • History button or Ctrl/Cmd + to browse all past searches
  • Click the trash icon to delete individual history entries

Settings

Configure default search options in Settings → Search and Replace with Regex:

  • Set default case sensitivity
  • Enable whole word matching by default
  • Enable regex mode by default
  • Adjust maximum history items (5-50)

Examples

Search email addresses

\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b

Search and replace dates

Search: (\d{4})-(\d{2})-(\d{2})
Replace: $3/$2/$1

Remove duplicate words

Search: \b(\w+)\s+\1\b
Replace: $1

Development

Setup

npm i

Build

npm run build

Watch mode

npm run dev

Lint

npm run lint

Format

npm format

License

0-BSD License

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.