Regular expressions to the rescue again!
- Click
Home > Replace
(or pressCtrl+H
) to display the “Find and Replace” dialog box. - Click
More>>
button to expand the dialog box. - Clear any formatting (click
No Formatting
button) - Check the “
Use wildcards
” box.
Remove duplicate words
- Enter
(<*>) (\1)
in theFind what
box. - Enter
\1
in theReplace with
box. - Click the
Replace All
button.
The \1
identifies a recurrence of the previous expression, in this case, any sequence of characters followed by a space. See How to use wildcards.
Remove duplicate paragraphs
- Enter the
(*^13)(\1)@
in theFind what
box. - Enter
\1
in theReplace with
box. - Click the
Replace All
button.
The \1
identifies a recurrence of the previous expression, in this case, any sequence of characters followed by a carriage return (represented by the code ^13
). The @
makes Word find one or more occurrences of the repeated item. So the expression (*^13)(\1)@
finds a paragraph that is repeated by itself one or more times, and the replacement \1
replaces what is found (the repeated paragraph or paragraphs) with the paragraph itself. See How to use wildcards and How to Replace text.