bongho467 downloadsFind and replace text using regular expressions with real-time preview and match highlighting.
A powerful find and replace plugin for Obsidian that supports regular expressions with real-time preview and match highlighting.
$1, $2, etc.)g), case-insensitive (i), and multiline (m) flagsmain.js, manifest.json, and styles.css from the latest release<YourVault>/.obsidian/plugins/regex-replace/Cmd/Ctrl + Shift + HCmd/Ctrl + P → "Open Regex Replace"┌─────────────────────────────────────────────┐
│ Search Pattern: [Enter regex pattern] │
│ Replace With: [Replacement text] │
│ │
│ Flags: ☑ g (global) ☐ i ☐ m │
│ ☐ Replace in selection only │
│ │
│ 3 match(es) found │
│ │
│ Before: Hello [world], hello [world] │ ← Yellow highlight
│ After: Hello [WORLD], hello [WORLD] │ ← Green highlight
│ │
│ Matches (3): │
│ • "world" → "WORLD" │
│ │
│ [Replace All] [Cancel] │
└─────────────────────────────────────────────┘
| Use Case | Search Pattern | Replace | Result |
|---|---|---|---|
| Find numbers | \d+ |
[NUM] |
abc123 → abc[NUM] |
| Date format | (\d{4})-(\d{2})-(\d{2}) |
$3/$2/$1 |
2024-12-08 → 08/12/2024 |
| Remove extra spaces | \s+ |
|
Multiple spaces → single |
| Wiki to MD link | \[\[(.+?)\]\] |
[$1]($1.md) |
[[Note]] → [Note](Note.md) |
| Header H2 → H3 | ^## |
### |
## Title → ### Title |
| Remove bold | \*\*(.+?)\*\* |
$1 |
**bold** → bold |
| Extract link text | \[(.+?)\]\((.+?)\) |
$1: $2 |
[text](url) → text: url |
| Flag | Name | Description |
|---|---|---|
g |
Global | Replace all matches (not just the first) |
i |
Ignore Case | Case-insensitive matching |
m |
Multiline | ^ and $ match line starts/ends |
Use parentheses () to capture groups and reference them with $1, $2, etc.:
Search: (\w+)@(\w+)\.com
Replace: User: $1, Domain: $2
Input: [email protected]
Output: User: test, Domain: example
Access via Settings → Regex Replace:
| Setting | Description | Default |
|---|---|---|
| Default Flags | Pre-selected regex flags | g |
| Show Preview | Display before/after preview | true |
| History Limit | Max saved patterns | 10 |
# Clone the repository
git clone https://github.com/bongho/obsidian-regex-replace.git
# Install dependencies
npm install
# Build for development (watch mode)
npm run dev
# Build for production
npm run build
# Run tests
node test.js
MIT License - see LICENSE for details.
Contributions are welcome! Please feel free to submit a Pull Request.
If you find this plugin useful, consider:
Made with ❤️ for the Obsidian community