Quick Tip: Using MS Word’s Search & Replace on Formatting

Did you know that in Microsoft Word, it is possible to do a search and replace on the formatting of text? For example, say that you’ve been given a bibliography that has all of the book titles in bold, but proper form is for book titles to be in italics. Using the search and replace function, it’s easy to change all of the bold text to italics in one fell swoop.
More Search & Replace Options

  1. Highlight the section of text to be affected (if not the whole document).
  2. Bring up the search and replace tool (Ctrl+H).
  3. Click on the More button to reveal the formatting options.
  4. Click in the Find What box, so that it has focus (there should be a flashing cursor there).
  5. Click on the Format button, and select Font…
    Search & Replace Format Options
  6. Select Bold (or whatever format you’re trying to change from).
  7. Click in the Replace With box, so that it now has focus.
  8. Click on the Format button, and again select Font…
  9. Select Italics (or whatever format you’re trying to change to).
  10. Click on Replace All

Changing fonts is just the tip of the iceberg. This technique can be used with any sort of formatting (paragraphs, styles, etc.)  Also, be sure to click on the Special button to see the options that are available there (Any Digit, Any Letter, etc.)  These wildcards and special symbols (along with plain text) can be used in combination with the formatting criteria.  For example, it’s possible to change all negative numbers to red this way, by specifying the Find What as a minus sign followed by the Any Digit notation and by specifying the Replace With as nothing but with a font color of red.

Trackbacks & Pings

Comments

  1. Word’s ability and ease here is a big advantage over OpenOffice Writer.

  2. One of the things keeping me with Word is the able to replace styled text. Are there any other editors that can compete?

  3. Sir, please tell me how to find the ” cut, copy and pasted word” in the word document. please help me to find this

  4. How do I change internal spacing after end punctuation?

    I need to change from two spaces after punctuation to one?

  5. How do I change internal spacing between end punctuation?

    I need to change from two spaces to one in a lengthy document.

  6. To replace sentence punctation, search for the period followed by two spaces and replace with a period followed by one space.

    FIND
    .
    REPLACE WITH
    .

    Don’t type “”. Just hit the space bar. It won’t be visible since a space isn’t a typed character, but Word can search for the precise number of spaces entered into the FIND field.

  7. Is there any way you can use search and replace for text within a text box? I am using Word 2007.

  8. How do I replace a space with a return? I have a huge list of names that are separated by spaces, but I cannot get them in a single row.

  9. You can ignore last post, I went ahead and imported it into Excel and did a special paste. Thanks anyways.

  10. How do I find a “tab character”?

  11. For next time, the Return key is represented by ^p (the P stands for paragraph-break).

  12. Tab is ^t. There’s 22 different codes like this. To see them all, click the [Special] button at the bottom of the Find and Replace dialog box. Whatever item you select, it will automatically add that code to the Find-What or Replace-With field (whichever one last had focus). Next, time, you can type the code in directly, yourself, if you remember it, or just use the Special button again.

  13. Help!!! Not sure how to do this…

    I have a couple hundred cases that need to be composed in a relatively short amount of time. I have 50 page template put together, and all I would have to do, is replace a number of repetitive terms. For example:

    “Disclosed herein are new class of (X) and their applications and methods thereof. Methods of (Y) of (Z) activity are also provided”.

    Is there some type of form that I can put together where:
    X= pyrazoles
    Y= inhibition
    Z= histamine receptor

    Remember mad libs? Is there anything like this? I will need to define X, Y, and Z’s individually for each case, but I will be repeating the variables over and over.

    Help!!!!

  14. Dana,

    That’s a typical mail merge operation. If you look up “mail merge” in the Word help, you’ll find instructions for setting up your template in one Word document and your list of substitutions in another document (as a table). The template will contain “fields” with names that correspond to the column headers of your table. You’ll then merge the two documents to produce a third document, that being the template text repeated once for every row in the table, with the row data inserted into the corresponding fields.

  15. That sounds exactly like what I want, but I can’t seem to find the info to get started from the help menu–mail merge turns up 20+ hits, and I can’t tell which one I need to follow. I will take a closer look at it tomorrow morning…

    Thanks for pointing me in the right direction!

  16. I have four documents made of hundreds of 7 digits numbers. I need to replace numbers in all the pages randomly: if number 7772222, 5555555, 2221111,3331111 are present anywhere on any of the four documents, I need to be able to erase them altogether, not one by one and not in order, the numbers are not stored on a sequence. Is there a way to do this? thank you

  17. Is there a way to do a replace by finding the instances of a lowercase letter next to a uppercase letter (nT) and putting a [return] between the two. I have names and titels right next to each other that need to go on separate lines.

  18. Lisa, Yes. First, check the box labeled “Use Wildcards”. In the Find-what field, enter “([a-z])([A-Z])” (without the quotes). In the Replace-with field, enter, “\1^p\2″ (without the quotes).

    The parenthesis group the find-what into parts (so that the replace-with can refer to them by number (\1, and \2). The square-brackets denote a set of possible characters to match, where a-z and A-Z are ranges within the set. ^p is the paragraph separator.

  19. I have downloaded a text file, i think 10 pt courier,where spaces have been used to
    line up the text -, which is basically two coulms.

    opening this file in word ( or excel )
    produces mal-formatting; the text is all there
    lots of it in the right place, but quite a bit
    scatterd with weird spacing.

    can i fix this without editing every line.
    ( my file is 2k lines long )

    In wordgn a file

  20. Jon, Yes. There are a couple of ways to approach this. Probably the easiest is to replace all occurrences of two or more spaces with a single tab character. To do this, check the box labeled “Use Wildcards”. In the Find-what field, enter ” {2,}” (without the quotes, that’s a single space before the left brace). In the Replace-with field, enter, “^t″ (without the quotes).

    The {2,} means two-or-more of whatever is to the left (i.e. the space). After you click Replace-All, the two columns will be tab-separated, except for any lines where there happened to be only one space between them (or no spaces at all). You’ll have to fix those up manually.

  21. Craig
    A MOST interesting suggestion, and very precisely described.
    Definitely one for the notebook.
    tried what you said on a few sample pages, but I am still left with more manual editing than I can manage.
    Perhaps some experimental variation may do more of my task.
    Is an attack on whitespace likely to do more harm
    than good.
    What was the other approach you envisioned, or will that cost me!

  22. Jon, That didn’t work? Did you change the tab stops so that the first tab stop is to the right of the widest text in the left column?

    Anyway, if all you are trying to do is get them to line up again, use Ctrl-A to select all text, then set the typeface to a mono-spaced font, like Courier New. (Or if you want to work with Styles, change the font for the Normal style to a mono-spaced font, or create a new style based on Normal, perhaps called Normal Mono, and make it mono-spaced. — Like I said, there’s lots of ways.)

    BTW, Once you have the text lined up again, you could, if you wanted to, select one column or the other by holding down the Alt key as you click and drag. (Yes, you can select all 2000 lines that way. Just be patient as Word slowly scrolls.) You can then do things like cut, copy, and paste the selected column, do a search and replace that’s restricted to the selected column, etc.

    For example, you could swap the two columns left-for-right with cut and paste. (Tip: Replace all ^p with ^p^t first. That will insert a tab character at the beginning of each line. Then, when you cut the entire right column and paste it to the left of the first tab character (of the first line), all the lines will become tab-separated (with lots of extra spaces at the end of each line that you could delete or ignore). To delete them, replace _^p with just ^p (the underscore here represents a space). Keep repeating the search-and-replace until it can;t find any more.

  23. Alex, I just noticed your question from earlier. Hopefully, you found your answer already, but if not…

    To match on any 7-digit number, check the box labeled “Use Wildcards”. In the Find-what field, enter ”[0-9]{7}” (without the quotes). In the Replace-with field, enter seven nines, or seven X’s, or whatever it is you want to do to redact those numbers.

    The {7} means it must match seven of whatever is to the left (i.e. the [0-9], which refers to the set of all digits, zero thru nine).

    Or, did I misread your question? Are you saying that you have a (long) list of specific numbers (that all happen to be 7-digits) to be replaced? If so, see my article on using SED (stream editor), via Cygwin, to run a SED script.

  24. I am having trouble witrh Word 2007 in that I have a text file with three tabs followed by a paragraph . (^t^t^t^p) that I want to repalce with three tabs and a $ such that I can replace all of the paragraphs wirth tabs and then replace the $ with paragraphs such that I get a tabbed deliminated file with paragraphs at the end of each line such that I can import into excel…. Every time I try to replace or find the original tabs with paragraph word 2007 freezes up…..Our tech support got it to work once by saving the fine as a doc as opposed to txt then finding tab tab then finding tab tab tab then finding tab tab tab paragraph then doing the replace… I can’t reduplicate this….it works fine in 2003 but these special charaters mess up in 2007….

    Any thoughts,.,,,

  25. How can I search a long document to see if there are any numbered lists in it?

Post a Comment


Your email is never published nor shared. Required fields are marked *



© 2006-2007 Maxim Software Corp.  All rights reserved.