word 2010 find and replace wildcards and formatting

I have a large number of Word documents that have been poorly formatted. Many of them are just glossaries of terms where the paragraph starts with the word or phrase and a colon, then a space and the definition. Each entry is separated by 2 paragraph markers since the author didn't know about space after or space before options.

I want to search for the text between the 2 paragraphs and the ": space" and replace it with a character style to make it stand out (such as bold, but I'd probably use a style entry, not just font bold).

Can someone suggest how to search for a string of text between specific characters like the ^p^p pair and the ": " pair? I may just go into the documents and replace all the ": " with something like a tab or ~ and then convert text to table columns, but that might put my document in a layout I don't want to keep.
Shannon MollenhauerAsked:
Who is Participating?
 
Eric FletcherConnect With a Mentor Commented:
Coincidentally, I've just had to do exactly this for a job I'm currently working on.

First, use Find and Replace to flag the start of the strings ending with the colon so you can later use the wildcard F&R to set the font attribute: in Find what, use ^p^p and in Replace with, use ^pþ (I used Alt-0254 here for the þ but any unique character or string is okay).

Now use F&R with wildcards to set the font attribute for the characters up to and including the colon:
turn on the Use wildcards checkbox (click More>> to reveal it)
in Find what, use (þ)(*:) [note the parentheses]
in Replace with, type \2
press Ctrl-B to set the Format to Font: Bold
click Replace All

This finds patterns consisting of þ and any number of characters up to and including a colon. The parentheses set it up as two expressions so the replace operation can deal with them differently. Here, \2 causes it to replace the found pattern with just the 2nd expression, and effectively removes the þ character used as the flag. The replace also applies the font attribute to the content found in the 2nd expression.

Note that you can specify the format via the Format button in F&R; here I just used the Ctrl-B shortcut to apply bold. In my application, I applied a character style (Format > Style...) because I wanted to both alter the font and be able to use it in a STYLEREF field code for page headers.
0
 
BenefordCommented:
On the find replace dialog, open the More section and use 'special' button to select the paragraph mark (^v).
You can also add formatting to the replace text if you want to.
0
 
Paul SauvéRetiredCommented:
Are the ': ' and the '^p^p' always in one string?

If so,
Find what: : ^p^p
Replace with: :^p

What you can do is select a unique paragraph style for the Replace with: ^p.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Paul SauvéRetiredCommented:
If this is NOT the case, please post PART of a file with what you want to reformat and simply change the text, but not the format of one existing file.
0
 
Shannon MollenhauerAuthor Commented:
The sample looks like this:

^p
^p
Term to be defined: Definition text defining the term.^p
^p
Another term:

What I am after is to find the text "^p^pWhatever term is before the colon and the colon itself" and replace it with bold formatting or replace it with a style sheet element that includes bold or whatever I choose. It should end up like this:
^p
^p
Term to be defined: Definition text defining the term.^p
^p
Another term: Another definition of that term.^p
^p

I'm familiar with how to specify the formatting I want in the replace field. What I can't get to work is any combination of special marks codes like ^p and wildcards for the text between the previous ^p and the colon/space combination.
0
 
Shannon MollenhauerAuthor Commented:
I know there are ways to apply formatting to elements of text in a string in Adobe InDesign which helps for formatting paragraphs, catalog entries, etc. (see Adobe's Classroom in a book for the exercise). I was just hoping I could accomplish something similar in Word because I've probably got about 80 pages of these kinds of glossary documents. It might just be easier to replace the ": " with a special symbol, convert text to table, and format the first column with the style I want, then hide grid lines and borders so it doesn't look so "tabular". Then I can add new columns for additional information about each entry and do exports to other platforms easily.
0
 
Paul SauvéRetiredCommented:
It looks like you may have to resort to a VB macro command to accomplish this - not really my area of expertise...
0
 
Paul SauvéRetiredCommented:
I have to go right now, but I'll have a second look when I get back in a few hours.
0
 
Paul SauvéRetiredCommented:
I have found an obscure solution to your problem. I know it is possible to have a paragraph mark that doesn't change lines by adding a control code. But I can't remember what the code is. Basically, you have two paragraphs on a single line. I saw this in one of my documents some years ago, so I know that it exists.
0
 
Shannon MollenhauerAuthor Commented:
PaulSauve:
I'm not worried about the two paragraph marks. I'll replace those with a single paragraph and space after style later. I'm just trying to find a way to select the words at the beginning of the next paragraph up to the : and apply formatting to it.
0
 
Paul SauvéRetiredCommented:
What I am saying is that it is possible to have TWO paragraphs in a single line - I just can't remember how to do this
0
 
Eric FletcherCommented:
I posted before adding a note re PaulSauve's comment above. To break a paragraph without starting a new line, press Ctrl-Alt-Return to insert a "style separator" character. It shows up as a hidden pilcrow (¶), and allows you then to apply a different style on each side of it.

This can be used to get run-in heads included in tables of contents: the 1st part might be tagged with, say, Heading 5, and the second with, say, Body Text so the TOC field would pick up the run-in Heading 5 part.
0
 
Paul SauvéRetiredCommented:
Eric - EUREKA, that's exactly what I couldn't remember... Thanks a lot.

Paul :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.