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?

  26. Hi. I want to learn how to search/replace strings of BOLDED (or italicized or underlined) words or phrases (i.e. any characters + spaces) with the appropriate html tags wrapped around the same text?

    For example, let’s say what appears in UPPER CASE in the following lines are formatted in bold…

    —————————————————
    Which brand of AEROSOL FURNITURE SPRAY / CLEANERS FOR USE ON WOOD SURFACES would you NEVER consider purchasing?
    —————————————————

    Is there a way to replace the partially “BOLDED” string of text above so it ends up looking like this?…

    —————————————————
    Which brand of AEROSOL FURNITURE SPRAY / CLEANERS FOR USE ON WOOD SURFACES would you NEVER consider purchasing?
    —————————————————

    I figured out how to do one word at a time, but I can’t figure out how to do the entire string of bolded text, including spaces and other special characters, such as the slash (/) in the above example.

    Can you help?

    Thanks in advance!

    Lolly

  27. Oops. I now see that my previous example interpreted the html tags into actual bold. Perhaps I should have used something more like this to depict what I’m trying to do in Word. I’d like to search/replace something like this…

    —————————————————
    Which brand of AEROSOL FURNITURE SPRAY / CLEANERS FOR USE ON WOOD SURFACES would you NEVER consider purchasing?
    —————————————————

    …into something like this…

    —————————————————
    Which brand of [b]AEROSOL FURNITURE SPRAY / CLEANERS FOR USE ON WOOD SURFACES[/b] would you [b]NEVER[/b] consider purchasing?
    —————————————————

    Hopefully this makes more sense.

    Thanks again!!

  28. I am a new student this year. I really don’t know much of anything about computers. I would really love to learn as much as I can. If I can during this class, I would love to learn everything there is to know about computers.

  29. Hi please suggest me
    I wanted to convert field codes in normal text with same like what i mentioned below is there any wildcard to replace or else how is it possible i tried for finding wildcard using ^19 it is not going to find the field code ^d it is going to find field code.

    {XE “Scinece”}some text

    Thanks in advance

  30. I just read through all of this, and hope you know an answer for my conundrum. I have a file that represents data from a survey, and each response is a line of text and begins with a number. I need to tab-delimit the text to enter it into a database. I’d like to be able to search for a numeric character followed by a space, and replace the space with a tab. Everything I try (including the ”[0-9]{7}” suggestion above) replaces everything INCLUDING the number; I just want to replace the space. I used to know how to do this in Word back in about 1996, but don’t know if the same scripting language still applies, and hope it can be done with less effort than actually writing scripts. Ideas? Thanks in advance!

  31. I have a list of names and telephone numbers that need to be formatted. All the surnames are supposed to be in capitals and the first names in lower case. Unfortunately when the list was updated over the year, the new names weren’t entered in this format. Now I’m trying to prepare it for print, is there an easy-ish way of making the surnames upper case? Currently it looks like: BLOGGS Fred 123456789
    Bloggs Jane 123456789 etc.

    Thanks for any help

    Jenni

  32. Is there a way to do a search and replace on text with different formatting, such as m3 with the 3 being superscript. Using the advanced and under font I select superscript and it will superscript the entire thing. I don’t want to do a search on just the 3 because my documents contain a lot of numbers. Right now I do a search for m3 and then I do a paste. It would be so much simpler to do it all within the search and replace function.

  33. I’m having trouble with Microsoft word and excels Find and Replace
    functions. Any help would be really appreciated.
    Basically i have an excel file that is thousands of columns down..
    which I need to change the formatting!!

    I am trying to take digits that start out looking like:

    0314-T210557

    And turn them into:

    14-Mar-09 21:05:57

    So far, (In Microsoft word) I have used Find and Replace to get rid of
    the dash and the T. I have also used find and replace and put a tab in
    between the 0314 and the 210557.. (so that when I put it back into
    excel, they are in separate columns).

    However, I cannot figure out how to get the 210557 looking like a
    time.
    What I want to do is use Find and replace to put : in between the
    21:05:57…
    In the find box, I can use ^# .. but it will not let me put those in
    the replace box. How can I do this???
    So
    Find: ^#^#^#^#^#^#
    Replace: ^#^#:^#^#:^#^#
    But this keeps giving me an error message that I cant put ^# into the
    replace box. Any ideas?

    Also, Does anyone have any advice how how I can turn 0314.. into 14-
    mar-09?

    Thank you so much for any help you can give!!!

  34. Like your column here, looks like a lot of great advice you’ve given out so far. Here’s a puzzler for you, I can’t seem to find it anywhere! Probably need to turn to macros/VBA to do this, if it’s possible…

    I have a document with each page being a letter with a date at top. However, this date is encapsulated in an IF field (won’t go into why that is, too complicated). What I need to do, is be able to do a simple Find & Replace on that date, to be able to change all the dates in the whole document. The problem is that, because we never ‘break out’ of the field, we are simply changing the field labels, and when you try to print, it reverts back to the original date (because it’s still an IF statement at its core).

    Do you know of any way to find all instances of X, and replace with Y, but replace TEXT ONLY (similar to Excel’s copy->paste special->values only)? That would break us out of the field situation and we’d have a winner…

    Thanks for any ideas you have or resources you might point me to…

Post a Comment


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



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