Regex Replacements

Power user feature: use regex patterns in Custom Words for advanced text transformations like ALL CAPS, spacing cleanup, and punctuation fixes.

How Regex Triggers Work

Prefix any Custom Words trigger with / and Speakmac treats it as a regex pattern. This unlocks pattern-based replacements instead of exact matches.

Quick Syntax Reference

/pattern/Regex trigger (the trailing / is optional)
$0Full match. $1, $2... = capture groups
\UPrefix replacement to uppercase the result

Setup

  1. 1Open Settings → Custom Words
  2. 2Add a trigger that starts with /
  3. 3Add a replacement (use $0, $1 for captures, \U for uppercase)
  4. 4Rules are case-sensitive and run in order

Essential Presets

ALL CAPS

Convert every word to uppercase.

Trigger:
/\b\p{L}+\b/
Replace:
\U$0
hello worldHELLO WORLD

Collapse Double Spaces

Turn multiple spaces into a single space.

Trigger:
/\s{2,}/
Replace:
(single space)
hello worldhello world

Remove Space Before Punctuation

Fix transcription spacing around punctuation.

Trigger:
/\s+([,.!?;:])/
Replace:
$1
word , moreword, more

Formatting Presets

Normalize Ellipses

Keep ellipses consistent at three dots.

Trigger:
/\.{3,}/
Replace:
...
wait.....wait...

Hyphens to Em Dashes

Convert hyphens surrounded by spaces into proper em dashes.

Trigger:
/\s*-\s*/
Replace:
word - wordword — word

Percent Formatting

Convert spoken 'percent' to the % symbol.

Trigger:
/\b(\d+)\s?percent\b/
Replace:
$1%
50 percent50%

Cleanup Presets

Uppercase Acronyms

Keep common tech acronyms properly capitalized.

Trigger:
/\b(api|sdk|gpu|cpu|html|css|json)\b/
Replace:
\U$0
the api returns jsonthe API returns JSON

Remove Filler Words

Strip common verbal fillers. Pair with double-space cleanup.

Trigger:
/\b(uh|um|like)\b/
Replace:
(single space)
I uh think um yesI think yes

Troubleshooting

  • Invalid regex: Check your pattern syntax. Common issues: unescaped special characters, mismatched brackets.
  • Too aggressive: Add word boundaries \b to limit matches to whole words.
  • Order matters: Rules run in sequence. Put broad cleanup rules (spacing) after specific ones.
  • Case sensitivity: Regex is case-sensitive. Use [Aa] to match both cases.

Need help with a custom regex? [email protected]

Ready to power up?

Download Speakmac

Get the app and unlock regex-powered text transformations.

Requires macOS 14+ and Apple Silicon.