Word 2003: Advanced Find & Replace Broken? (long post)

A

alexw

Hi,

I am not a new user, but I couldn't find a suitable group for this, so
I posted it here.
I'm experiencing strange behaviour with Word's (2003 SP3) Advanced
Find & Replace w/ the "Use wildcards" option.

What I'm trying to do:
Find all paragraphs consisting only of numbers, add a prefix to the
number and replace the closing paragraph mark with a whitespace.
This is to move recitals (marginal numbers) to the beginning of the
related paragraph.

The first problem I encountered was with search (this is w/ a .txt
file made from the original .doc, so the recitals become regular
paragraphs w/ only the number in them).
Searching for paragraph marks with ^13 works.
Searching for numbers with ([0-9]{1;}) works as well (please note that
this is a German localized system, so ';' is indeed correct).
Combining both to ^13([0-9]{1;})^13 doesn't work. It finds none of the
targets and 'finds' several completely wrong numbers w/ no paragraph
marks next to them.
Neither do ([0-9]{1;})^13 or ^13([0-9]{1;}) work.

So far, the description was for a .txt file.

After the attempts described above not working, I moved to the actual
incoming .doc file, which has the recitals formatted with a special
paragraph style and a positioning frame (btw, I'm not sure whether I
use the correct English expressions because, unfortunately, I'm forced
to use a localized German version of Word).

Removing the positioning frame is easy. I can also easily replace the
paragraph marks by spaces when searching w/ the style required.
What goes wrong completely, is trying to add the prefix to the recital
numbers. The behaviour is *very* strange.
When I try to add the prefix to the expression itself, it is
- added completely *after* the number (expression) instead of being
prepended if the prefix is one or two letters;
- added in part before the number and after the number, if the prefix
is three or more letters, w/ less letters added before the number and
more letters added after the number if the number of digits goes up.

This behaviour occurs both w/ and w/o the "Use wildcards" option ("\1"
and "^&", resp., with the prefix added correctly before them in the
"replace" field).

To me, this looks like broken code/a bug. Almost posted this
in .applicationerrors, but that one looks more like a developers
forum.

Any ideas?
 
D

Doug Robbins - Word MVP

You should be searching for

([0-9]{1;})^13

and replace with

prefix\1[space]

where you replace prefix with the prefix that you want to use and you press
the spacebar in place of [space]

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
A

alexw

You should be searching for
([0-9]{1;})^13
and replace with
prefix\1[space]
where you replace prefix with the prefix that you want to use and you press
the spacebar in place of [space]

Haven't been back to this thread for a while because I solved the
problem in a completely different way, but for the record:
I *did* search for ([0-9]{1;})^13, I wrote that. But Word did not find
anything until I did "replace" all ^13 with ^13 (!). Then the search
worked. Go figure.
However, Replace did not. It kept adding characters at the end of the
number instead of in front.
I saved everything to .txt and used Ultraedit's search/replace which
worked without any problems.
Problem unsolved on the Word side (and I still think this is a huge
bug), but doesn't matter anymore.
 
P

PamC via OfficeKB.com

Wild card replace does not work as expected when track changes is on.

PamC
You should be searching for
([0-9]{1;})^13
and replace with
prefix\1[space]
where you replace prefix with the prefix that you want to use and you press
the spacebar in place of [space]

Haven't been back to this thread for a while because I solved the
problem in a completely different way, but for the record:
I *did* search for ([0-9]{1;})^13, I wrote that. But Word did not find
anything until I did "replace" all ^13 with ^13 (!). Then the search
worked. Go figure.
However, Replace did not. It kept adding characters at the end of the
number instead of in front.
I saved everything to .txt and used Ultraedit's search/replace which
worked without any problems.
Problem unsolved on the Word side (and I still think this is a huge
bug), but doesn't matter anymore.
 
A

alexw

Wild card replace does not work as expected when track changes is on.

PamC,

thank you so much, you solved the mystery!
Of course, change tracking was on (I never use it myself, but most
documents I get thrown at me have it activated), and this was the
cause of the problem.
However, IMO the expression "does not work as expected" is a little
bit too friendly. In my eyes this *does* qualify as an ugly bug.
 
P

PamC via OfficeKB.com

Yes it does. But it's been there for 3 or 4 years now, maybe longer (& the
heat has gone away from me). It took me several days back then to figure out
why it worked sometimes but not others. Now it's pretty much habit to switch
off track changes and switch to final view before I run any S&R that calls
for switching word order. I haven't even checked to see if the bug is still
there in W2007!

Glad to help,
PamC
 

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