Find the last item

G

Greg Maxey

I should know this but I am drawing a blank.



Using Find>Replace>Use Wildcards



Find: b*^13

Replace with: ^& with format bold



Why is the last line missed? (Note -It isn't if I ensure there is an empty
paragraph following the last line)



It was the best of times it was the worst of times

It was the best of times it was the worst of times

It was the best of times it was the worst of times

It was the best of times it was the worst of times

It was the best of times it was the worst of times

It was the best of times it was the worst of times

It was the best of times it was the worst of times


Thanks.
 
H

Herb Tyson [MVP]

Ummm... it wasn't missed here--all lines were changed (and I made sure there
was only 1 paragraph mark at the end). I wonder if your last paragraph mark
is defective. I assuming you're using Word 2003. I wonder if we have the
same compatibility settings (although I can't think of anything there,
offhand, that would affect the results). Mine is set up as vanilla Word
2003.
 
G

Greg Maxey

Herb,

Something odd going on here. My compatibility was Word2003 vanilla with two
toppings.

Add space for underlines
Draw underlines on trailing spaces

I cleared both and replacement worked as expected.

I then closed Word. Went in and reapplied the two compatibility options and
replace still works as expected.

One of those perplexing things about Word.

Thanks for the nudge.
 
R

Russs

I should know this but I am drawing a blank.



Using Find>Replace>Use Wildcards



Find: b*^13

Replace with: ^& with format bold



Why is the last line missed? (Note -It isn't if I ensure there is an empty
paragraph following the last line)



It was the best of times it was the worst of times

It was the best of times it was the worst of times

It was the best of times it was the worst of times

It was the best of times it was the worst of times

It was the best of times it was the worst of times

It was the best of times it was the worst of times

It was the best of times it was the worst of times


Thanks.

Greg, I was able to simulate what you said, if I run the replace with the
cursor at the end of the file. If I move the cursor to the beginning of the
file, the replace does find all the lines including the last one. Is that a
bug in Word? I'm using Word 2004 on the Mac.
 
R

Russs

Greg, I was able to simulate what you said, if I run the replace with the
cursor at the end of the file. If I move the cursor to the beginning of the
file, the replace does find all the lines including the last one. Is that a
bug in Word? I'm using Word 2004 on the Mac.
I was able to narrow it down to the fact that if the cursor is before the
'b' in the last sentence, it will find the whole phrase in the last
sentence. Therefore it must only check from the cursor position to the end
of the current sentence that the cursor is in even if you want to check the
whole document.
 
R

Russs

I was able to narrow it down to the fact that if the cursor is before the
'b' in the last sentence, it will find the whole phrase in the last
sentence. Therefore it must only check from the cursor position to the end
of the current sentence that the cursor is in even if you want to check the
whole document.
Sorry to appear to ramble on, but I'm sending off messages as I think of
something new.
So it seems that Word marks the last sentence segment as already checked and
doesn't see it again when it comes around full circle.
Yes, it is like a bug.
One way they could fix it is always start a 'global' document search from
the beginning of the file.
 
R

Russs

Sidenote: Hi Russs--did you know there are also Mac-specific MS newsgroups?
You may find them useful someday.

See here for Google/Entourage gateway to newsgroups for MacWord, MacExcel,
and other MS programs for the Mac:
<http://www.microsoft.com/mac/community/community.aspx?pid=newsgroups>
Thanks Daiya, for the link. I wasn't aware of that webpage. I knew about
Mactopia but didn't get involved with newsgroups until recently. I found the
newsgroups through Entourage. You must be on the West Coast because of our
difference in timestamps on our respective messages.

Yes, I have browsed most of the Microsoft Word newsgroups, including the Mac
newsgroup, for the last couple of months ever since I wanted to learn how to
use Word to data mine files at work, which use WinWord. So I've been
learning the ins and outs of Find and Replace and how to use them in macros.
I'm familiar with all kinds of programming and the use of regular
expressions or wildcards as Word calls them. I wish Microsoft would make the
wildcards as powerful as some of the better forms of regular expressions.

I'm comfortable on the Mac and Windows, but I love the Mac more, in big part
because I can be more productive with less time rooting out virii and other
malware or reinstalling the OS. I started off as a big fan of the Commodore
Amiga.

I did comment on another bug specific to the Mac, in the Mac newsgroup
thread, '^13 code for finding paragraph marks is broken!' As a kludge fix, I
can enclose ^13 like [\^13] to get it to work with wildcards on the Mac. Of
course, using \n, which is also specific to Mac, I believe, is easier, but
doesn't carry over to the Windows side in macros.

drsmN0SPAMikleAThotmailD0Tcom.INVALID <-- fix this before replying
 
K

Klaus Linke

Hi Russs,

You'll often run into problems when the cursor is in the middle of the
expression you are searching for.
More often than not, Word will miss the match since it searches downwards to
the end of the document, and then back from the start.


Find: a*b
does seem to match if a and b are in the same word, but not in other cases.

Probably the algorithm must decide how much of the text should be checked
twice, and has to draw a line somewhere.

It's safer to go to the beginning of the document (or story range) before
you start a wildcard search.

Regards,
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