Search & Replace--Word 2002-2003

J

Joe McGuire

How can I construct a search to find all instances of paragraphs numbered
from 1-44 (e.g., "39. plus a tab")and insert a paragraph ahead of each with
a fixed string of characters, like "xxx" for use as a marker? Of course I
want to leave those paragraph numbers intact. Each of the paragraphs
numbered 1-44 has a unique style (Rog label) and lots of indented
subparagraphs each with a unique indented style depending on the level
(e.g., Indent 1, Indent 2, etc.). I have struggled with Graham Mayor's
paper on wildcards but I can't seem to get to first base. Once I have the
xxx in place I can do more searching and replacing without recourse to
wildcards.
 
S

Suzanne S. Barnhill

I would guess you don't need wildcards. Leaving the "Find what" box blank,
click on More and choose Format: Style: Rog label.

In the "Replace with" box, type:

xxx^p^&

This will find each paragraph in the designated style and replace it with
itself, preceded by a paragraph in the same style containing "xxx." If you
then want to change the style of the "xxx" paragraph, you can run another
replacement to find "xxx" in Rog label style and apply a different style to
"xxx" or "^&."
 
G

Graham Mayor

A wildcard search for
([0-9]{1,2}^t)
will find all one or two digit numbers followed by a tab
replace with
xxx\1

or search for your paragraph style ie put nothing in the search box and set
format style Rog label
and in the replace box clear formatting and put
xxx^&
as the replace string. (no wildcards) This will add xxx to the start of any
paragraph in that style.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Suzanne S. Barnhill

Will this find autonumbered paragraphs, though?



Graham Mayor said:
A wildcard search for
([0-9]{1,2}^t)
will find all one or two digit numbers followed by a tab
replace with
xxx\1

or search for your paragraph style ie put nothing in the search box and set
format style Rog label
and in the replace box clear formatting and put
xxx^&
as the replace string. (no wildcards) This will add xxx to the start of any
paragraph in that style.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Joe said:
How can I construct a search to find all instances of paragraphs
numbered from 1-44 (e.g., "39. plus a tab")and insert a paragraph
ahead of each with a fixed string of characters, like "xxx" for use
as a marker? Of course I want to leave those paragraph numbers
intact. Each of the paragraphs numbered 1-44 has a unique style (Rog
label) and lots of indented subparagraphs each with a unique indented
style depending on the level (e.g., Indent 1, Indent 2, etc.). I
have struggled with Graham Mayor's paper on wildcards but I can't
seem to get to first base. Once I have the xxx in place I can do
more searching and replacing without recourse to wildcards.
 
J

Joe McGuire

Thanks! I never would have figured the search string out, and I can't
believe I could not figure out a search as simple as the alternative you
suggested. (Sound of dope-slapping in the background!)


Graham Mayor said:
A wildcard search for
([0-9]{1,2}^t)
will find all one or two digit numbers followed by a tab
replace with
xxx\1

or search for your paragraph style ie put nothing in the search box and
set format style Rog label
and in the replace box clear formatting and put
xxx^&
as the replace string. (no wildcards) This will add xxx to the start of
any paragraph in that style.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Joe said:
How can I construct a search to find all instances of paragraphs
numbered from 1-44 (e.g., "39. plus a tab")and insert a paragraph
ahead of each with a fixed string of characters, like "xxx" for use
as a marker? Of course I want to leave those paragraph numbers
intact. Each of the paragraphs numbered 1-44 has a unique style (Rog
label) and lots of indented subparagraphs each with a unique indented
style depending on the level (e.g., Indent 1, Indent 2, etc.). I
have struggled with Graham Mayor's paper on wildcards but I can't
seem to get to first base. Once I have the xxx in place I can do
more searching and replacing without recourse to wildcards.
 
J

Joe McGuire

thanks! No autonumbering in this document. Autonumbering is usually not a
very good idea in the legal world.

Suzanne S. Barnhill said:
Will this find autonumbered paragraphs, though?

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup
so
all may benefit.

Graham Mayor said:
A wildcard search for
([0-9]{1,2}^t)
will find all one or two digit numbers followed by a tab
replace with
xxx\1

or search for your paragraph style ie put nothing in the search box and set
format style Rog label
and in the replace box clear formatting and put
xxx^&
as the replace string. (no wildcards) This will add xxx to the start of any
paragraph in that style.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Joe said:
How can I construct a search to find all instances of paragraphs
numbered from 1-44 (e.g., "39. plus a tab")and insert a paragraph
ahead of each with a fixed string of characters, like "xxx" for use
as a marker? Of course I want to leave those paragraph numbers
intact. Each of the paragraphs numbered 1-44 has a unique style (Rog
label) and lots of indented subparagraphs each with a unique indented
style depending on the level (e.g., Indent 1, Indent 2, etc.). I
have struggled with Graham Mayor's paper on wildcards but I can't
seem to get to first base. Once I have the xxx in place I can do
more searching and replacing without recourse to wildcards.
 
S

Suzanne S. Barnhill

Ah, my proposed solution assumed you were using auto numbering.



Joe McGuire said:
thanks! No autonumbering in this document. Autonumbering is usually not a
very good idea in the legal world.

Suzanne S. Barnhill said:
Will this find autonumbered paragraphs, though?

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup
so
all may benefit.

Graham Mayor said:
A wildcard search for
([0-9]{1,2}^t)
will find all one or two digit numbers followed by a tab
replace with
xxx\1

or search for your paragraph style ie put nothing in the search box and set
format style Rog label
and in the replace box clear formatting and put
xxx^&
as the replace string. (no wildcards) This will add xxx to the start of any
paragraph in that style.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Joe McGuire wrote:
How can I construct a search to find all instances of paragraphs
numbered from 1-44 (e.g., "39. plus a tab")and insert a paragraph
ahead of each with a fixed string of characters, like "xxx" for use
as a marker? Of course I want to leave those paragraph numbers
intact. Each of the paragraphs numbered 1-44 has a unique style (Rog
label) and lots of indented subparagraphs each with a unique indented
style depending on the level (e.g., Indent 1, Indent 2, etc.). I
have struggled with Graham Mayor's paper on wildcards but I can't
seem to get to first base. Once I have the xxx in place I can do
more searching and replacing without recourse to wildcards.
 
J

Joe McGuire

Searching for the paragraph style certainly was simple. But searching for
numbers could be very useful to me in a different context, so I set to work
with it so I could learn how to better use Find & Replace. I found 2
problems to ask you about:

1. At first it found all instances of numbering, e.g. "2.->" (I'm using ->
to represent the tab character here), "3->" etc. But it also found all the
subparagraph numbering, such as "A->", "B->" etc. I fixed this by adding
the Style "Rog label" to the Find What line and then it worked. But if the
stuff I was looking for did not aleady have a unique style (somebody on my
staff apparently spent a lot of time manually applying the different level
styles to each paragraph and its subparts--way too much time, if this sort
of thing can be done using Find & Replace), the search would have been way
over-inclusive. Is there a way to limit the search to numbers?

2. The Find & Replace stumbled when it got to 2-digit numbers. I put
"xxx\1" in the Replace With line. From paragraphs 1-9 I got "xxx1.->",
xxx2.->" etc. Fine result. But starting with paragraph 10 it became
"1xxx0.->", "1xxx1.->", "1xxx2.->", which obviously is not what you had in
mind. Is there a way to have the text to be inserted added ahead of the
first of the digits?

[A future challenge will be how to use Find & Replace to do something with
an entire paragraph which starts with, say, this sort of numbering. But
first things first]

FYI we do not create the Word files for which Find & Replace might be
helpful. They are formal interrogatories in legal proceedings prepared by
opposing lawyers for which we prepare formal legal responses for our
clients. For a lot of reasons we want the questions and answers together in
the final response, in a format we can easily control. Sometimes these are
sent to us by others as Word files, but with no formatting beyond using a
bunch of tabs (or spaces) to create indented sub-paragraphs. Most of the
time we get the files as paper or PDFs and have to convert them to Word, a
headache in its own right.

Graham Mayor said:
A wildcard search for
([0-9]{1,2}^t)
will find all one or two digit numbers followed by a tab
replace with
xxx\1

or search for your paragraph style ie put nothing in the search box and
set format style Rog label
and in the replace box clear formatting and put
xxx^&
as the replace string. (no wildcards) This will add xxx to the start of
any paragraph in that style.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Joe said:
How can I construct a search to find all instances of paragraphs
numbered from 1-44 (e.g., "39. plus a tab")and insert a paragraph
ahead of each with a fixed string of characters, like "xxx" for use
as a marker? Of course I want to leave those paragraph numbers
intact. Each of the paragraphs numbered 1-44 has a unique style (Rog
label) and lots of indented subparagraphs each with a unique indented
style depending on the level (e.g., Indent 1, Indent 2, etc.). I
have struggled with Graham Mayor's paper on wildcards but I can't
seem to get to first base. Once I have the xxx in place I can do
more searching and replacing without recourse to wildcards.
 
G

Graham Mayor

The second option would, provided the paragraphs were formatted with a
numbered style - but in view of later postings in this thread, this is no
longer necessary.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Will this find autonumbered paragraphs, though?


Graham Mayor said:
A wildcard search for
([0-9]{1,2}^t)
will find all one or two digit numbers followed by a tab
replace with
xxx\1

or search for your paragraph style ie put nothing in the search box
and set format style Rog label
and in the replace box clear formatting and put
xxx^&
as the replace string. (no wildcards) This will add xxx to the start
of any paragraph in that style.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Joe said:
How can I construct a search to find all instances of paragraphs
numbered from 1-44 (e.g., "39. plus a tab")and insert a paragraph
ahead of each with a fixed string of characters, like "xxx" for use
as a marker? Of course I want to leave those paragraph numbers
intact. Each of the paragraphs numbered 1-44 has a unique style
(Rog label) and lots of indented subparagraphs each with a unique
indented style depending on the level (e.g., Indent 1, Indent 2,
etc.). I have struggled with Graham Mayor's paper on wildcards but
I can't seem to get to first base. Once I have the xxx in place I
can do more searching and replacing without recourse to wildcards.
 
G

Graham Mayor

Plan B - on further reflection it wouldn't work with autonumbering - the xxx
would appear after the number :(

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Will this find autonumbered paragraphs, though?


Graham Mayor said:
A wildcard search for
([0-9]{1,2}^t)
will find all one or two digit numbers followed by a tab
replace with
xxx\1

or search for your paragraph style ie put nothing in the search box
and set format style Rog label
and in the replace box clear formatting and put
xxx^&
as the replace string. (no wildcards) This will add xxx to the start
of any paragraph in that style.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Joe said:
How can I construct a search to find all instances of paragraphs
numbered from 1-44 (e.g., "39. plus a tab")and insert a paragraph
ahead of each with a fixed string of characters, like "xxx" for use
as a marker? Of course I want to leave those paragraph numbers
intact. Each of the paragraphs numbered 1-44 has a unique style
(Rog label) and lots of indented subparagraphs each with a unique
indented style depending on the level (e.g., Indent 1, Indent 2,
etc.). I have struggled with Graham Mayor's paper on wildcards but
I can't seem to get to first base. Once I have the xxx in place I
can do more searching and replacing without recourse to wildcards.
 
S

Suzanne S. Barnhill

The second option is similar to the one I offered, which does work. It
requires xxx^p^&. As I pointed out, this generates another paragraph in the
same style, so it would be numbered as well, but you can then search for xxx
in that style and apply Normal or some other style, which restores the
numbering.



Graham Mayor said:
The second option would, provided the paragraphs were formatted with a
numbered style - but in view of later postings in this thread, this is no
longer necessary.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Will this find autonumbered paragraphs, though?


Graham Mayor said:
A wildcard search for
([0-9]{1,2}^t)
will find all one or two digit numbers followed by a tab
replace with
xxx\1

or search for your paragraph style ie put nothing in the search box
and set format style Rog label
and in the replace box clear formatting and put
xxx^&
as the replace string. (no wildcards) This will add xxx to the start
of any paragraph in that style.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Joe McGuire wrote:
How can I construct a search to find all instances of paragraphs
numbered from 1-44 (e.g., "39. plus a tab")and insert a paragraph
ahead of each with a fixed string of characters, like "xxx" for use
as a marker? Of course I want to leave those paragraph numbers
intact. Each of the paragraphs numbered 1-44 has a unique style
(Rog label) and lots of indented subparagraphs each with a unique
indented style depending on the level (e.g., Indent 1, Indent 2,
etc.). I have struggled with Graham Mayor's paper on wildcards but
I can't seem to get to first base. Once I have the xxx in place I
can do more searching and replacing without recourse to wildcards.
 
G

Graham Mayor

To limit the search to numbers you use
[0-9]
The search pattern I reported was based on the information provided
originally.
i.e. two digits followed by a tab thus: ([0-9]{1,2}^t)
will find all one or two digit numbers followed by a tab
If there are more than 2 numbers, amend the information in the brackets
thus {1,3} will find one to three digits and {1,} will find at least 1
digit.
xxx\1
If you want it to locate the complete paragraph beginning with a sequence of
numbers and a tab then use
([0-9]{1,}^t*^13)
\1 puts back everything in the round brackets. If that is the whole search
string you could use ^& instead.

If it is not working correctly switch on the formatting marks (CTRL+* or
click the ¶ button) so that you can see what is happening.

You need to re-read http://www.gmayor.com/replace_using_wildcards.htm which
explains all the techniques used.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Joe said:
Searching for the paragraph style certainly was simple. But
searching for numbers could be very useful to me in a different
context, so I set to work with it so I could learn how to better use
Find & Replace. I found 2 problems to ask you about:

1. At first it found all instances of numbering, e.g. "2.->" (I'm
using -> to represent the tab character here), "3->" etc. But it
also found all the subparagraph numbering, such as "A->", "B->" etc. I
fixed this by adding the Style "Rog label" to the Find What line
and then it worked. But if the stuff I was looking for did not
aleady have a unique style (somebody on my staff apparently spent a
lot of time manually applying the different level styles to each
paragraph and its subparts--way too much time, if this sort of thing
can be done using Find & Replace), the search would have been way
over-inclusive. Is there a way to limit the search to numbers?
2. The Find & Replace stumbled when it got to 2-digit numbers. I put
"xxx\1" in the Replace With line. From paragraphs 1-9 I got
"xxx1.->", xxx2.->" etc. Fine result. But starting with paragraph
10 it became "1xxx0.->", "1xxx1.->", "1xxx2.->", which obviously is
not what you had in mind. Is there a way to have the text to be
inserted added ahead of the first of the digits?

[A future challenge will be how to use Find & Replace to do something
with an entire paragraph which starts with, say, this sort of
numbering. But first things first]

FYI we do not create the Word files for which Find & Replace might be
helpful. They are formal interrogatories in legal proceedings
prepared by opposing lawyers for which we prepare formal legal
responses for our clients. For a lot of reasons we want the
questions and answers together in the final response, in a format we
can easily control. Sometimes these are sent to us by others as Word
files, but with no formatting beyond using a bunch of tabs (or
spaces) to create indented sub-paragraphs. Most of the time we get
the files as paper or PDFs and have to convert them to Word, a
headache in its own right.
Graham Mayor said:
A wildcard search for
([0-9]{1,2}^t)
will find all one or two digit numbers followed by a tab
replace with
xxx\1

or search for your paragraph style ie put nothing in the search box
and set format style Rog label
and in the replace box clear formatting and put
xxx^&
as the replace string. (no wildcards) This will add xxx to the start
of any paragraph in that style.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Joe said:
How can I construct a search to find all instances of paragraphs
numbered from 1-44 (e.g., "39. plus a tab")and insert a paragraph
ahead of each with a fixed string of characters, like "xxx" for use
as a marker? Of course I want to leave those paragraph numbers
intact. Each of the paragraphs numbered 1-44 has a unique style
(Rog label) and lots of indented subparagraphs each with a unique
indented style depending on the level (e.g., Indent 1, Indent 2,
etc.). I have struggled with Graham Mayor's paper on wildcards but
I can't seem to get to first base. Once I have the xxx in place I
can do more searching and replacing without recourse to wildcards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top