Woven Words Logo




Tips



Resources



About Woven Words

Keeping your numbers and units stuck together

I've been asked how to solve another common Find and Replace... issue - that of replacing the normal space between numbers and their units with a non-breaking space. This is a useful way of making sure you never get bad breaks in the middle of, say, '20 kg' or '55 cm'.

Again, the wildcard facility in Word will do this quickly and easily. The instructions are similar to the hyphen Find and Replace... procedure mentioned elsewhere.

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

  1. Go to Edit > Replace...
  2. Make sure the Use wildcards option is selected.
  3. In the Find what: box, type in the following:
  4. ([0-9]) (<[A-z]@>)
    Note that there is a space between the two bracketed expressions.
  5. In the 'Replace with:' box, type in the following:
  6. \1^s\2
    Note that the ^s means a non-breaking space.
  7. Click on Replace All.

Brief explanation

The [0-9] means find any digit. The round brackets mark this as one instance of what you want to find. The first angled bracket in <[A-z]@> means find the beginning a word. [A-z] means find any letter, whether upper or lowercase, the @ sign means to repeat the last find (in this case, any letter) and the second angled bracket means to continue searching for letters until the end of the word. Thus the first line finds every instance of any digit which is followed by a space and any word.

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 (in this case, a word). The ^s indicates a non-breaking space. Thus, the text will be replaced with whatever the original digit was, followed by a non-breaking space, followed by whatever the original word was. This allows you to just change the space, without having to know exactly what numbers and letters are surrounding it.

Home | Tips | Resources
About Woven Words

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