Interesting but no help I'm afraid.
Yes, I see this in Word 2003 (with no service packs); it happens with very
simple searches - the \n replacement seems to be put before whatever should
be before it. I can't explain it and can't offer any way round it either.
--
Enjoy,
Tony
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> A user I work with has found an unusual bug in Microsoft Word, and I'm
> wondering if there is a fix for it that ya'll know about. Here's the
> scenario. It only is a problem when he has Tracking Changes turned on:
> the find and replace works fine when Tracking Changes is off.
>
> I've got some text in a document, that includes ..."claim 1"...
> (although the number could be replaced with any other string of
> characters, where the first character is a digit, in the example search
> and replace I am performing, the number has to be exactly 1 digit
> long). I want to put a flag character before and after the string
> beginning with the number. I search for the following string in the
> Find and Replace dialog box: "<([Cc][Ll][Aa][Ii][Mm]> )([0-9])", with
> wildcards activated. This search performs perfectly. I then replace
> it with the following string: "\1#\2#". What this should do is delete
> the text "claim 1" from the document and insert "claim #1#" instead.
> (Microsoft Word probably has some formula that dictates where the
> inserted text is put relative to the deleted text, but I can't figure
> out the pattern: it appears to be all over the map. What should
> definitely hold true, though, is that if I were to accept both the
> deletion and insertion, I would end up with pound signs before and
> after the number string. And ideally, the deletion and insertion would
> be done in blocks: all deleted characters together, and all inserted
> characters together.) But what actually happens is that the characters
> are inserted out of order, and in such a way as to make the replacement
> worthless for future use. Here is what comes out (with bolded
> characters representing the deleted characters, and underscores the
> inserted characters):
>
> claim c1laim 1##
>
> I can replace the pound signs in the replace string with anything I
> want, the result is the same (except that where the number is inserted
> into the deleted word "claim" depends on the length of the string I was
> putting before the number.
>
> The problem definitely relates to the use of wildcards: specifically,
> the use of the "Find what expression" in the Replace string (that is,
> the \1, \2, etc). I know this because if I were to search for
> "<([Cc][Ll][Aa][Ii][Mm]> )1" and replace it with \1#1#, the text "claim
> " is inserted before the deleted text, whereas the "#1#" is inserted
> after the deleted text. And if I were to do a find and replace without
> any "Find what expressions", all of the original text is deleted first,
> then all of the replacement text is inserted. But since I need to do
> this from within a macro, I have to use the "Find what expression" to
> do the search and replace.
>
> Any ideas?
>
> Thanks in advance.
>
|