Skip to content

Instantly share code, notes, and snippets.

@frederickding
Created April 18, 2025 21:00
Show Gist options
  • Save frederickding/52607353c3bf6fbe26416de0398f95ef to your computer and use it in GitHub Desktop.
Save frederickding/52607353c3bf6fbe26416de0398f95ef to your computer and use it in GitHub Desktop.
Replace hyphen in number ranges in Word with en dash
  1. Ctrl+H to launch Find and Replace dialog.
  2. Check "Use wildcards".
  3. Type <([0-9]@)-([0-9]@)> in the "Find what:" box. This pattern represents a search for whole words that have one number, a hyphen, and another number.
  4. Type \1^=\2 in the "Replace with:" box. This maintains the numbers found in the find, while substituting the hyphen with an en dash.
  5. Click the "Find Next" button to step through each instance and replace. I do not recommend using Replace All.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment