• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 983
  • Last Modified:

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.
0
Shannon Mollenhauer
Asked:
Shannon Mollenhauer
  • 7
  • 3
  • 2
  • +1
1 Solution
 
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
 
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
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
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:
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
 
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 7
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now