A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Microsoft Word Help
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Search wildcard difficulty



 
 
Thread Tools Display Modes
  #1  
Old April 5th 11, 02:43 PM posted to microsoft.public.word.docmanagement
Paul B.[_2_]
external usenet poster
 
Posts: 2
Default Search wildcard difficulty

Hi,

I'm having a greediness problem with Word 2003's wildcards. I'm trying to find each occurrence of the beginning of a line, followed by some text, then ending with "Page " and then a number. Here's an example:

This is a Chapter Name Page 13

So with wildcards enabled, I tried ^13?{10,65}Page [0-9]{1,2}

The problem there is that Word applies the {10,65} limiter to the entire previous expression, so I get multiple paragraphs selected. In effect, I get from the cursor point to the next Find hit.

So I tried placing the '?' in parentheses, I tried using [a-zA-Z ] instead of '?', and none of these brought any hits. That I don't understand.

The immediate question is how can I limit my hit to only one paragraph?

Thanks for any insight.
Ads
  #2  
Old April 7th 11, 03:40 AM posted to microsoft.public.word.docmanagement
Jay Freedman
external usenet poster
 
Posts: 9,855
Default Search wildcard difficulty

On Tue, 5 Apr 2011 06:43:10 -0700 (PDT), "Paul B." wrote:

Hi,

I'm having a greediness problem with Word 2003's wildcards. I'm trying to find each occurrence of the beginning of a line, followed by some text, then ending with "Page " and then a number. Here's an example:

This is a Chapter Name Page 13

So with wildcards enabled, I tried ^13?{10,65}Page [0-9]{1,2}

The problem there is that Word applies the {10,65} limiter to the entire previous expression, so I get multiple paragraphs selected. In effect, I get from the cursor point to the next Find hit.

So I tried placing the '?' in parentheses, I tried using [a-zA-Z ] instead of '?', and none of these brought any hits. That I don't understand.

The immediate question is how can I limit my hit to only one paragraph?

Thanks for any insight.


Use this expression:

^13[!^13]@Page [0-9]{1,2}

It says to find a paragraph mark followed by one or more characters that are
not paragraph marks, followed by a page number. There is no upper limit on the
number of not-paragraph-marks, but you're guaranteed that the found text will
all be within one paragraph.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
wildcard search Huber57 Microsoft Word Help 1 January 8th 10 10:25 PM
What is wrong with this wildcard search? Paul B[_5_] Microsoft Word Help 2 August 8th 09 06:40 PM
Wildcard search for *: Ben Bullock New Users 3 October 21st 07 11:36 PM
Wildcard search help. please? Ed Microsoft Word Help 2 September 11th 06 08:50 PM
Help with wildcard search, please? Ed New Users 8 July 28th 06 11:18 AM


All times are GMT +1. The time now is 04:28 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright 2004-2021 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.