Search and Replace Regex

by Justice Vellacott
5
4
3
2
1
New Plugin

Description

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.

Reviews

No reviews yet.

Stats

stars
downloads
0
forks
0
days
NaN
days
NaN
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
0
commits

Latest Version

Invalid date

Changelog

README file from

Github

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

Action Shortcut
Search Ctrl/Cmd + F
Replace Ctrl/Cmd + H
Next match F3 or Enter
Previous match Shift + F3
Replace single Ctrl/Cmd + Enter
Replace all Ctrl/Cmd + Shift + H
History Ctrl/Cmd + ↓
Exit search Esc

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