# Obsidian - Regex Pipeline
![[images/Obsidian-Regex-Pipeline.webp]]
[Watch on YouTube](https://www.youtube.com/watch?v=u19lFykVII8) · 39:53 · Josh Plunkett · 2023-09-03
> Written from the video's full English captions (en-orig automatic captions via timedtext after a yt-dlp 429), with chapter times from the description. Supporting walkthrough and copy-paste rules live on his [RegEx / Regex Pipeline tutorial page](https://obsidianttrpgtutorials.com/Obsidian+TTRPG+Tutorials/Plugin+Tutorials/Community+Plugins/RegEx/RegEx). He rates this an **intermediate** (orange) video because he supplies the patterns; writing your own from scratch would be a red/challenging topic.
## Outline
### 00:00 Intro: wiki paste and citation junk
- Tonight's shout-out is a **new plugin** that has been speeding up his Forgotten Realms vault work. He constantly pastes location notes from wikis (example: **Shadowdale**) and ends up with citation markers like `[5]` and `[6]` that point at the wiki's reference list.
- Those markers are useful on a public wiki; they are noise in a personal campaign vault. Manually deleting them one by one is "slow" and "clunky."
- Demo payoff: highlight the pasted chunk, right-click **Replace Sources**, and the markers disappear. The same menu can run other custom rules, and the rules themselves are editable.
### 02:51 Plugin Setup
- Settings → **Community plugins** → Browse → search **regex**. He installs and enables **Regex Pipeline** by **No3371** ("Set up custom regex rules to automatically format notes").
- Difficulty call-out: this is an **intermediate** video because he will show the code you need. If you invent your own patterns it becomes a red/challenging topic. Regex edits are relatively safe on a single note (Ctrl+Z works) but he still says to keep backups.
- In the plugin options he raises **Quick rules** (and related limits) from the default three up to **five** so more of his rulesets appear on the right-click menu.
- Left ribbon: a **dice icon** opens **Regex rule sets**. New vaults just see a **+** button; press it, name a command (e.g. "my command"), and define a find → replace pair. Trivial example: find `the` → replace with `THE`, then right-click to run it.
![[images/Obsidian-Regex-Pipeline-t0315.webp]]
*Community Plugins browse for "Regex": Regex Pipeline by No3371 shows as Installed alongside Regex Find/Replace and Dynamic Highlights.*
![[images/Obsidian-Regex-Pipeline-t0440.webp]]
*Right-click menu on pasted Underdark wiki text with Regex Pipeline commands: Replace Sources (highlighted), Convert to Encounter, Convert to Statblock, Convert External Links.*
### 06:24 Supporting Tutorial
- Mid-roll note: he has added supporting content on [obsidianttrpgtutorials.com](https://obsidianttrpgtutorials.com) under Plugin Tutorials → generic/community plugins → **Regex Pipeline**, with an install button, a short regex primer, links he uses in the video, and **copies of the code** with step-by-step explanations.
### 07:25 Replace Source References
- Obsidian is not the place to invent regex. He copies the messy wiki paste into [regex101.com](https://regex101.com) as a closed test harness.
- Goal pattern: anything like `[12]` — a square bracket, one or more digits, a closing square bracket. Square brackets are special in regex, so they must be escaped: `\[` and `\]`.
- Character class `[0-9]` matches one digit; a trailing `+` matches a run of digits. Full pattern roughly: `\[\d+\]` / `\[0-9+\]` style. He verifies it against several wiki pages before trusting it.
- Back in Obsidian he creates a ruleset **New Replace Sources**, find = that pattern, replace = empty (`[]` / nothing), Save. Raising Quick rules to 5 (or 10) is required before the new command appears on the right-click menu; otherwise run it from the dice panel. Toast confirms the ruleset executed and the citation numbers vanish.
![[images/Obsidian-Regex-Pipeline-t1430.webp]]
*After running New Replace Sources: a toast reports the ruleset under `.obsidian/regex-rulesets/` executed one replacement pass on the Underdark note.*
- Some wiki pages also use `[citation needed]`. A digits-only pattern misses those. Options: hard-code `\[citation needed\]`, or a looser `[A-Za-z ]+` class inside brackets. He prefers the specific phrase so the rule does not chew through unexpected bracketed text (e.g. URLs).
- Combining both with a regex **OR** (`|`): citation-needed **or** digit run, still wrapped in escaped brackets. Paste the combined pattern into the ruleset and re-test.
### 18:52 Edit Regex Pipeline Command
- The in-app UI does **not** let you edit an existing ruleset's pattern. Rules live in the vault under **`.obsidian/regex-rulesets/`**, one file per command (e.g. `New Replace Sources`). Open with Notepad / Notepad++, paste the improved pattern, save, then re-run from the right-click menu.
- He acknowledges regex "looks like the Matrix" at first; his Patreon has a slower find-and-replace walkthrough, and the same material is headed to the tutorial site.
### 21:01 Convert to Statblock
- Beyond cleanup: type **orc**, highlight it, right-click **Convert to Statblock** → inserts a Fantasy Statblocks fence with `monster: Orc`. Same idea for **Convert to Encounter**.
- Under the hood (opened from `.obsidian/regex-rulesets/`): find a single word `([a-zA-Z]+)`, store it in capture group `$1`, replace with the plugin's required ` ```statblock ` / `monster: $1` fence. Two-word monster names would need a space in the character class — he flags that as future work.
![[images/Obsidian-Regex-Pipeline-t2120.webp]]
*After Convert to Statblock on "Orc": the note shows a `statblock` code fence with `monster: Orc` under the Kelemvor lore paste.*
### 25:37 Convert to Encounter
- Convert to Encounter is the same capture idea, but the replacement is an `encounter-table` fence that uses `$1` twice (encounter name and creature line). Still one-word names for now.
- Live improv: change the find pattern to `([0-9]+) ([a-zA-Z]+)` so **"4 Orc"** becomes quantity `$1` and name `$2` in the creatures list. Highlight, right-click, and the encounter table shows four orcs. He wants an if/default-to-1 later but does not add it in-video.
![[images/Obsidian-Regex-Pipeline-t2815.webp]]
*Notepad editing the Convert to Encounter ruleset: find `([0-9]+) ([a-zA-Z]+)` → encounter-table with `name: $2` and `- $1: $2`, while regex101 shows a match on "4 Orc".*
### 28:57 Convert External Links
- Pasting from a wiki with plain Ctrl+V often brings markdown links; **Ctrl+Shift+V** pastes plain text (then Replace Sources can strip citations).
- Pasting rules text from **D&D Beyond** (Dodge / Hide / Help) leaves awkward constructs like empty `[](url)` links beside titles. He builds patterns on regex101 to capture the display text into `$1` and rewrite as clean `[[wikilinks]]`.
- Right-click **Convert External Links** turns those into vault-facing links (Stealth, Unseen Attackers, etc.); leftover title-only junk is handled next.
### 33:59 Replace DnDB Titles
- Second DnDB-oriented ruleset **Replace DnDB Titles**: capture the trailing title after the empty-link form and replace the whole mess with `[[$1]]`. Created via the dice **+** UI (pattern must sit between brackets; find→replace uses the dash-arrow syntax the plugin expects).
- Reminder: rules live under `.obsidian/regex-rulesets/`; the **index** file is the menu of available rulesets. Delete a bad ruleset file, remove its line from the index, save, and **Reload** in the dice panel to clean up.
### 37:55 Outro
- Regex Pipeline is "very handy" for right-click shortcuts; he is only scratching the surface. Ready-to-paste rules will be on the site so this stays intermediate rather than challenging.
- Take backups before going deep. Thanks to Patreon supporters; community/support and the **Obsidian Keep TTRPG Community Discord** are linked from obsidianttrpgtutorials.com. Closing advice: do not dive into the deep end of regex first — wade, then swim.
## Things mentioned
### Obsidian plugins, themes and features
- **Regex Pipeline** by No3371: named regex rulesets, dice ribbon panel, right-click Quick rules, files under `.obsidian/regex-rulesets/` plus an index (**free** community plugin)
- **Fantasy Statblocks**: target of Convert to Statblock (` ```statblock ` / `monster: …`); also used with his Alt+T monster insert workflow (**free**). See related Fantasy Statblocks notes on the channel.
- **Encounter tables** (` ```encounter-table ` fences): target of Convert to Encounter
- Community plugins browser / enabling community plugins
- Right-click editor menu and ribbon commands
- Vault config folder **`.obsidian/regex-rulesets/`** (per-ruleset files + index)
- Related: other regex tools that appear in Browse (**Regex Find/Replace**, **Dynamic Highlights**) — not the focus of this video
### Websites, tools and guides
- [regex101.com](https://regex101.com): safe sandbox for building and testing patterns before pasting them into Obsidian (**free**)
- [Obsidian TTRPG Tutorials – RegEx / Regex Pipeline](https://obsidianttrpgtutorials.com/Obsidian+TTRPG+Tutorials/Plugin+Tutorials/Community+Plugins/RegEx/RegEx): install link, primer, and copy-paste rules with explanations (**free**)
- [Forgotten Realms Fandom Wiki](https://forgottenrealms.fandom.com/) (Underdark / Shadowdale examples) (**free**)
- [D&D Beyond](https://www.dndbeyond.com/) Basic Rules combat actions (Dodge, Hide, Help) used as paste examples (**free**/account; some content paid)
- Josh's **Patreon** regex introduction article (**paid**, optional)
- [Obsidian](https://obsidian.md/) (**free** core app)
- Notepad / Notepad++ for editing ruleset files outside Obsidian (**free**)
- Obsidian Keep TTRPG Community Discord via the Community tab on his site (**free**)
### TTRPG systems and content
- **D&D 5e** / Forgotten Realms vault (**Obsidian5eVault**): Shadowdale, Underdark geography paste, Kelemvor lore, Orc statblock/encounter demos
- Wiki citation markers and `[citation needed]` cleanup for personal notes
- D&D Beyond action text (Dodge, Help, Hide, Stealth, Unseen Attackers) cleaned into wikilinks
### Free vs paid (quick)
- Free: Obsidian core, Regex Pipeline, Fantasy Statblocks, regex101, his tutorial site and Discord, Forgotten Realms wiki
- Paid / optional: Patreon article; some D&D Beyond content beyond free Basic Rules
## Bios
- **Josh Plunkett**: Australian GM and educator behind Obsidian TTRPG Tutorials (YouTube and obsidianttrpgtutorials.com). He runs a heavy Forgotten Realms / 5e Obsidian vault and uses Regex Pipeline to turn repetitive paste-cleanup and monster-insert steps into right-click shortcuts.
- **No3371**: Developer of the **Regex Pipeline** Obsidian community plugin that stores custom find→replace rulesets and exposes them on the editor context menu and a ribbon panel.