Results 1 to 9 of 9
  1. #1
    Lounger
    Join Date
    May 2003
    Location
    Detroit, Michigan, USA
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Find & Replace Problem (Word 97)

    Hi, I'm having problems with find-replace.

    1. Does Word see things differently if you do wild card searches in a *.txt
    rather than a *.doc file?
    I needed to find lines that begin with a space. In the text file, Word was
    willing to find "^13" but not "^13 "
    I found I had to save as a doc file, close down Word, and then restart.
    Is that normal, or did the problem solve itself some other way?

    2. Maybe the problem wasn't with wildcards after all. I later found with a
    similar file that Word could only find about half the paragraph markers. It
    took ^13 in a normal search to find the rest. What could that mean?

    3. Is there a way to format a replacement group?
    In lines such as: "Author: Smith, John" I wanted to change the "Smith,
    John" to bold.
    But when I told it to bold "1" it did nothing. Then, when I told it to
    bold "Author: 1" it bolded "Author:" but not "Smith, John"

    Thanks for any help
    Al Gruber
    <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

  2. #2
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find & Replace Problem (Word 97)

    If you want to search/replace paragraph marks, I'd definitely save as a document first, and would not work on the opened text file directly.

    One bug I've come across: If the text file contains a ^13^10, and this occurs a multiple of 256 bytes from the start of the file, Find/Replace is likely to run into trouble.

    Say your paragraph marks are random, and you replace ^p^p with ^p, Word would miss about one in 256 ^p^p.


    As to your third question: You could achieve that in two wildcard replacements. I don't know how your file looks, so I'll assume that "Author: Smith, John" is on a line by itself, and that the name may vary.

    Find what: (Author: )(*)(^13)
    Replace with: 123

    Find what: (*)
    Replace with: 1 ((bold))


    BTW, often you can use wildcard replacemets cleverly to change the formatting in a single replacement.

    Say, the ":" following "Author" doesn't match the formatting of "Author" (maybe it's sometimes bold, or italic, or in another font altogether).
    To clean that up and make the formatting match, you could replace
    Find what: (Author):
    Replace with: 1:

    The ":" would pick up the formatting of "Author".

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Find & Replace Problem (Word 97)

    > One bug I've come across: If the text file contains a ^13^10, and this occurs a multiple of 256 bytes from the start of the
    > file, Find/Replace is likely to run into trouble.

    Incredible. Incredible that you figured this out. Incredible that such a bug exists. I remember a bug long ago involving either DOS copy or Windows 3.x File Manager or Windows Explorer (I can't remember which). When more than 256 files were selected, every 256th file was not copied. Big whoops if you then deleted without checking! There's just something about that number. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  4. #4
    Lounger
    Join Date
    May 2003
    Location
    Detroit, Michigan, USA
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find & Replace Problem (Word 97)

    Klaus,
    Tell me if this is what your example shows:
    Is the in your first replace is just a marker, no different from ## or ~~ or whatever?
    And is the ((bold)) a special formatting command that works only in wildcard mode?
    If that guess is wrong, please explain,
    Al

  5. #5
    Lounger
    Join Date
    May 2003
    Location
    Detroit, Michigan, USA
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find & Replace Problem (Word 97)

    jscher,
    I don't know. I thought I tried the ^p in the text file both in normal and in wildcard mode and it did not work either time.
    I'll give it another shot.
    Thanx, Al

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Find & Replace Problem (Word 97)

    <P ID="edit" class=small>(Edited by jscher2000 on 11-Aug-03 20:58. Compared a different format of Text file and got different results, so updated the table.)</P>Regarding #1 and #2: A Word paragraph is supposed to end with a carriage return-line feed pair (^13^10). This is well-disguised in DOC files, but less well disguised in TXT files opened in Word. Here are my results of limited testing:

    <table border=1 bordercolor=black bgcolor=white cellspacing=0 cellpadding=7><td>Document Type</td><td>Wildcards OFF</td><td>Wildcards ON</td><td>Word (native .doc, Windows)</td><td>^p : good
    ^13 : good
    ^13^10 : nothing found
    ^10 : nothing found</td><td>^p : error
    ^13 : good
    ^13^10 : finds every paragraph marker
    ^10 : error</td><td>Text (Windows)</td><td>^p : good
    ^13 : nothing found
    ^13^10 : good
    ^10 : good</td><td>^p : error
    ^13 : nothing found
    ^13^10 : finds every paragraph marker
    ^10 : error</td><td>Text (UNIX)</td><td>^p : good
    ^13 : nothing found
    ^13^10 : nothing found
    ^10 : good</td><td>^p : error
    ^13 : nothing found
    ^13^10 : finds last paragraph marker only
    ^10 : error</td></table>
    Overall, the wildcard searches don't work very well for this type of Find. Hope this helps.

    (Note: for anyone who didn't read the beginning of the thread, there is a trailing space in the search query; it's not just there for aesthetics.)

    (Note #2: Tested in Word 2002.)

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Find & Replace Problem (Word 97)

    It sounds as though your file is inconsistent in the way it handles ends of lines (mixing ^13^10 with just ^13 or just ^10). This makes it difficult, but hopefully not impossible. For example, as a first step you could replace all ^13 with ^p (wildcards OFF) and then go from there.

  8. #8
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find & Replace Problem (Word 97)

    Yes, or you could save in *.doc format to clean up the inconsistent "paragraph marks".

  9. #9
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find & Replace Problem (Word 97)

    > Is the in your first replace is just a marker, no different from ## or ~~ or whatever?

    Exactly, you could use any other markers or tags just as well.

    > And is the ((bold)) a special formatting command that works only in wildcard mode?

    No, I meant "Format > Font > bold".
    I usually just press Ctrl+B in "Replace with".

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •