RFeplacing formatting w/ tags, ALMOST there but need help

C

CompleteNewb

I'm committing the egregious cross-post, because the other group doesn't
seem that often visited.

I've gotten surprisingly far with replacing formatting in a Word document
with html tags, but one thing is not working.

Anywhere I have two new paragraphs, some text, then a <br> (I already did
one pass putting the br's where I want them), I want to have the new
paragraphs and:

<p class="someclass">Any text here</p><br>

So, for example:

blah blah blah¶

Blah Blah Blah<br>
blah blah blah blah blah blah blah blah

Would become this:

blah blah blah¶

<p class="someclass">Blah Blah Blah</p><br>
blah blah blah blah blah blah blah blah

Now, I've tried using the replace like this:

Find: ^13^13*<br> (I'm using wildcards, so have to use the ^13 instead of
^p)

but it finds nothing. It WILL find the ^13^13, but if I use the * or
anything after that, it says there are no results. I made sure there are no
extra line breaks, carriage returns, etc. after the second ¶ (at least, I
think I did; Word doesn't show any marks after the second ¶, and I tried
looking for ^13^13^l as well, and it says there are none of those).

Can anyone help me figure out why I can't do this?

Thanks for any help, and I appreciate your time.
 
G

Graham Mayor

While
(^13{2})([!^13]*\<br\>)
replace with
\1<p class="someclass">\2
will find your string as described, * is a blunt instrument for this task
and you may find it locates rather more that you intended. You need to find
a way to narrow down your search to only the segment that you require - and
it may be necessary to use vba to select particular narrower ranges to
search.
See http://www.gmayor.com/replace_using_wildcards.htm

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

My web site www.gmayor.com

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

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