Learnit Training


3. Search and Replace (Basic and Continued)

The Find option allows us to search within the document for a particular text, e.g. a word or a sentence.
With the option Replace we cannot only search for a text, but we can also replace it with another text.
You can find these options on the Home tab in the Editing group:

We first look at how to search for a word.

  • Open the file: Haarlem railway station.docx
  • Click on on the tab Start in the group Edit.
    You can also use the Ctrl + F] use.
    The task window Navigation appears.
  • Type in the search box (document search): station
    As you type, everything with 'station' in it will be highlighted in the document: 'Station', 'railway station' and also in words like 'railway station' and 'railway building'.
  • The search results are also listed below the search box.
    Browse the results by clicking on them.

Search options

We can also search more specifically with Search Options. We will go through a few options here.

  • Click on the magnifying glass or list arrow behind the search box and then click on Options...

  • The following window appears:


    The options Highlight everything and Incremental search are already ticked.
    Then tick Identical upper/lower case and Whole word on.
    Click on the OK.
  • We will now search again for the word "station". Type in the search box: station
    You will now see that the search results contain only the exact word 'station'. Capitalised 'station' and non-whole words such as 'station building' and 'station restaurant' do not appear in the search results.
  • Click on the cross to make it Navigation to close the pane.

Replace

We can also have the found words replaced with another word.

  • Go to the Home tab, the Edit group:
  • Click on
    You can also use the Ctrl + H] use.
  • The Find and Replace task window appears.
    In the Find box, type: train station
  • In the box Replace with: drive
  • Click on the button:
    The first result found for "train station" has been replaced by "station".
  • The word 'railway station' appears several times in the document. We are going to replace all of them.
    Click on the button:
    All results for the search term 'train station' have now been replaced by 'station'.
  • Click Cancel to close the Find & Replace task window.

Delete double spaces with Replace

If you write a lot of texts, you often end up using too many spaces while typing. Those double spaces are easy to overlook. We can remove them in one go with the Replace option.

In our document Station Haarlem there are also too many spaces. We will remove these:

  • Click on on the tab Start in the group Edit.
  • The Find and Replace task window appears. In the Find box, type two spaces.
  • In the Replace box, type a space once.
  • Click on the button:
    All double spaces are now replaced by a single space.
  • Click Cancel to close the Find & Replace task window.

Searching and Replacing with Wildcards (Continued)

An advanced search option is searching with wildcards. You can use a wildcard if you don't know the spelling of a word or to define search terms more broadly. Here we discuss a few common wildcards:

  • Click on on the tab Start in the group Edit.
    The task window Navigation appears.
  • Click on the magnifying glass or list arrow behind the search box and then click on Options...

  • The following window appears:


    Tick the option Using wildcards on.
    Click on the OK.
  • Type in the search box: railway*n
    The wildcard * stands for any sequence of characters. Word will now find 'railway', 'railway station' and 'railway' among others.
  • Type in the search box: 184?
    The wildcard character ? stands for any character. Word now finds the years '1842' and '1844'.
  • Type in the search box: e@n
    The wildcard @ stands for zero or more occurrences of the preceding character. Word now finds 'and' and 'one'.
  • Finally, we type in the search box: [AR]??terdam
    The wildcard [] (brackets) stands for one of the characters between the brackets. Word now finds 'Amsterdam' and 'Rotterdam'.

We have now finished the exercise.