Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching in Word

Status
Not open for further replies.

ngardner

Technical User
Apr 1, 2002
35
AU
I have a user that wants to search through a document and find WORD1 and when it occurs with 5 words of WORD2.
I can see that this can partially be achieved by using wildcards in the find function: "WORD1 * WORD2"
Is there a way to limit this to only have 5 words between the two??
Thank you
 
Hi ngardner,

If you use this pattern you'll get as close as I can see how:

[tt]WORD1 (<[! ]{1,}>) (<[! ]{1,}>) (<[! ]{1,}>) (<[! ]{1,}>) (<[! ]{1,}>) WORD2[/tt]

This won't quite cope with words separated by other than spacing (paragraph marks, tabs, etc.) - let's hope someone else can do better. [smile]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top