Woven Words Logo




Tips



Resources



About Woven Words

Taking the 'hyph' out of hyphens

Editors commonly need to be able to replace hyphens between number or date spans with en dashes (e.g. 1980-90). So is there an easy way to do this using Find and Replace? Yes!

Basically, in order to do a Find and Replace on something like this, you have to resort to using the Use wildcards option in Word. So it goes something like this:

  1. Go to Edit > Replace...
  2. Make sure the Use wildcards option is selected. If you can't see this option, you may need to click on the little arrow at the bottom of the dialogue box to expand it.
  3. In the Find what: box, type in the following:
  4. ([0-9])-([0-9])
    Note: if this formula doesn't work, try using (<[0-9]@>)-(<[0-9]@>) instead.
  5. In the Replace with: box, type in the following:
  6. \1-\2
    Note that the dash is an en (Opt+hyphen (Mac) or Ctrl+hyphen (Windows))
  7. Click on Replace All and sing hallelujah!



Note: If you have been using Track changes..., you will need to turn it off before using this Find and Replace procedure, otherwise it won't work properly.

But what does it mean and how does it work?

Well, the [0-9] means find any digit, and the round brackets mark this as one instance of what you want to find. Thus the first line finds every instance of any digit which is followed by a hyphen and another digit.

In the second line, \1 says to repeat whatever it is that was found with the first set of round brackets (in this case, a digit) and \2 says to repeat whatever was found with the second set of round brackets. Thus, the text will be replaced with whatever the first digit is, followed by an en, followed by whatever the second digit is. This allows you to just change the hyphen, without having to know exactly what numbers are surrounding it.

You can, of course, also add to this search by looking for spaced hyphens, or hyphens with one space before or after, or even spaced en dashes. Combine all these into a macro, and you will be able to use just one keyboard shortcut or click on a button to convert all your number-span hyphens, spaced or not, with ens.

Thanks to David Blatner for his illuminating article on wildcards in Australian Macworld magazine, from which I was able to figure out this solution.

Home | Tips | Resources
About Woven Words

Go to topLast updated: Tuesday 28 September, 2004
© 2004