Can search be constrained to a matching line?

J

jfaughnan

I am unable in Word 2003 SP2 to find all lines ending in a search
string. I've reviewed Word's help file and O'Reilly's Word Annoyances.
I see a lot of powerful search features, some of which resemble UNIX
GREP. What's missing, however, are the GREP operators that anchor a
search string between the start of a line and the 'end of line'. Word
has a search operator for the paragraph return (^p if wildcard search
is disabled, else use ^13), but not an operator to anchor to the start
of line.

If I use a string like ^13*(my search phrase)^13 it matches what I
want, but it also includes ^13 as a valid character, so the search
spans additional lines.

Is there a way to constrain a search pattern to a "line" or a
"paragraph"?

Thanks!

john
(e-mail address removed)

meta: jfaughnan, jgfaughnan, GREP, Word, search, line search,
constrain, limit, pattern match
 
M

mpt

John, I tried writing a macro to search for "xyz" and then search for two
carriage returns. I then tied the macro to a keystroke combination that
triggered this search. The result was an unexpected inquiry after finding
"xyz" whether I wanted to search the rest of the doct. Not good. Also,
this would only search once within each paragraph or line.

Writing two macros might work. One to search for the string, the second to
search for the end of the paragraph. Fire either at operator discretion.

Also, "highlighting all the items found in the main doct" was pretty nifty
altho it still requires a lot of operator intervention.

Richard
Kluge King
 
J

John Faughnan

Thanks for checking this out! It does seem like a tough problem. Maybe
we'd need Microsoft to add a 'match to start of line' token to a future
version of Word.
 

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