bCentral Home
Your Online Business Center

Search and replace

Clever tricks to make search-and-replace easy and useful

Word's find and replace function is really quite extensive. It includes several clever tricks, including the ability to replace searched-for text with the contents of the Clipboard.

This means that you can replace individual words with a graphic or a very large chunk of text that you've previously copied to the Clipboard. Use Edit | Replace to enter the searched-for text. Click in the Replace with: field, select More, go for the Special button, then choose Clipboard Contents.

Say you want to replace each occurrence of your name with a scan of your handwritten signature. Do that manually the first time, then select the image and copy it to the clipboard (Ctrl + C). Now you can use Find And Replace (Ctrl + H, or Edit | Replace) to search for the text of your name in the Find what: field. Click in the Replace with: box, but don't enter anything; instead click the More button, then Special, and choose Clipboard Contents. This puts ^c into the Replace with: field, and subsequently you can speed things up by typing that yourself directly.

This technique can of course be used with anything you've put into the Clipboard, including, for example, a chunk of text too large or too complicated to key into the Replace with: box.

You can also use Find and Replace to search for many non-printing characters - again you start with Edit | Replace or Ctrl + H, click in the Find what: box, click on More and then Special. The list includes just about every non-printing character or formatting mark in Word. (It won't include Clipboard Contents unless you have already clicked in the Replace with: box.)

Alternatively, click on the Format button and you'll be able to change all the normal formatting options. You don't need any text selected in the Find what: or Replace with: boxes if you simply want to convert every instance of a particular format or combination.

For instance, text copied from a web page is often formatted by Word with the Normal (Web) style; to convert all of it to your Normal style, just use Format | Style and go for Normal (Web) as the Find what: option and Normal as the Replace With selection

Be sure to select No Formatting the next time you use Find and Replace, because those format options will now apply by default to all subsequent searches. (Settings such as Find entire words only are equally persistent.)

If you just want to find occurrences of conventional and unformatted text, it may help to search with wildcards. Click the Use wildcards box in the search dialog and you'll be able to include ? to match any single character and * to match any string of characters.

But the wildcard option can be much more sophisticated than that:

[abc]
match a single character from those inside the brackets. So a search for H[AE]LL will find HALL and HELL but not HILL. There seems no practical limit to the number of characters you can include in the brackets.

[a-z]
match a single character from the range inside the brackets. So a search for H[I-U]LL will find HILL and HULL but not HALL or HELL.

[!abc]
match a single character that is not inside the brackets. So a search for H[!UE]LL will find HALL and HILL but not HULL or HELL.

[!a-z]
match a single character that is not from the range inside the brackets. So a search for H[!I-Z]LL will find HALL and HELL but not HULL or HILL.

<
match a word that starts with the characters following - and the same square-bracket character combinations apply. So <GR will find GRAB and GRUBBY; <[P-R] will match any word starting with P, Q or R; <[!MN] will find any word that does not start with M or N.

>
match a word that ends with the characters following, and again the combinations apply.

{n }
match a word where the character preceding n times. So BO{2}M will match boom.

{n,m}
match a word where the character preceding appears between n and m times. So BO{2,3}M will match boom and booom but not bom or boooom.

\
matches a word containing the character following character, even if that's a wildcard. So a search for sl\*t will match sl*t but not slot.

When you search without using wildcards, by default the case of the search text is irrelevant - you have to specify Match case if you want that. But when you search using wildcards, the Match case option is switched on by default; so upper and lower case do matter.

Another feature to bear in mind: when you use the wildcards in searching, the Special button at the bottom of the Find dialog box displays different special characters for which you can search - a useful indication of the sophistication available when you use wildcards in your searching.

��Like what you've read? Try our free newsletters.

What next?

We've produced a number of printed How to... guides, showing you how to do new things with Microsoft software. You can download or order them free of charge from our download centre.


Sign into Microsoft Small Business+ for free web-based training and software support.

sign in
Security information

Find a local Microsoft Small Business Specialist to help with your IT needs

Microsoft Small Business SpecialistMore info >

What do you want your PC to help you with?

What do you want your PC to help you with?









Free business newsletters - subscribe now

Our free newsletters are packed full of business advice and ideas - plus all the latest news

Security information

Get the latest bulletins and updates direct from Microsoft