Find, move down two lines, insert page break

A

Allison

Word 2003, Windows XP SP2

Hi all,

I posted this in word.domanagement before I found this programming group.
It should probably be posted here.

I have a text document with hundreds of pages. I need to go through and
make sure that each new area begins a new page.

Each new area begins two lines after a row of hyphens. The row following
the row of hyphens varies, so I can't simply replace that row with the data
followed by a page break.

Any suggestions how to do this automatically or programmatically?

Sample of data:

end of prior section
------------- (entire row of hyphens)
more text here that varies
begin new section here

Thanks for your help.
 
K

Klaus Linke

Hi Allison,

It's not too difficult using a wildcard replacement:

With wildcards it's pretty easy too...

Check "Match wildcards",
Find what: -{3,}^13([!13]@^13)
Replace with: \1^m

-{3;} matches 3 or more hyphens, ^13 a paragraph mark, [!^13] any character
*but* a paragraph mark, and [!^13]@ any number of such aforementioned
characters.
(In some language versions, you have to use {3;} ... depending on whether
the field delimiter in your language is a comma or a semicolon.

Put together, -{3,}^13 matches a lot of hyphens hyphens followed by a
paragraph mark, ([!13]@^13) any paragraph.

Since I've put (brackets) around the latter expression, I can re-use the
matched text in the replacement, using \1 ... and ^m is a manual page break.

Regards,
Klaus
 
K

Klaus Linke

It's not too difficult using a wildcard replacement:
With wildcards it's pretty easy too...

Did I mention it's simple? And that I don't proofread my posts before I hit
"Send"?

;-) Klaus
 

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