View Single Post
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Paul B. Paul B. is offline
external usenet poster
 
Posts: 11
Default Wildcard problem

Wow, did that nail it! My continuing problem is that I don't know why
my expression ending in '.com' didn't work, or why 'MY GRACE *way.com'
was "non-greedy" in its findings, because many times I've found Word's
expressions to be greedy, capturing even multiple pages.

In any case, this makes the whole thing a lot simpler, and it's what I
will try first next time. Thanks much.

p.

On Aug 10, 5:18*am, "Graham Mayor" wrote:
Depending upon what else is in the document you could search for
MY GRACE *way.com

seehttp://www.gmayor.com/replace_using_wildcards.htm

or you could use a macro

Dim sFindText As String
Dim r As Range
Dim i As Long
sFindText = "MY GRACE IS SUFFICIENT"
Set r = ActiveDocument.Range
With r.Find
* * Do While .Execute(findText:=sFindText, Forward:=True) = True
* * * * r.End = r.Paragraphs(1).Range.End
* * * * r.MoveEnd wdWord, 21
* * * * If r.Characters.Last = Chr(32) Then
* * * * * * r.End = r.End - 1
* * * * End If
* * * * 'Do what you want with the found text - r - here e.g.
* * * * MsgBox r
* * * * r.Collapse wdCollapseEnd
* * Loop
End With

--

Graham Mayor - *Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Paul B." wrote in message

...



I'm almost there on a search expression, but the last step is
confounding me. Here's what I'm looking for:


MY GRACE IS SUFFICIENT FOR YOU 9/47
All Rights Reserved - The Good Way Publishing - 2010
http://www.the-good-way.com


This expression:
* * MY GRACE[a-zA-Z0-9/ ^13\-:.]{11,122}


Finds this:


MY GRACE IS SUFFICIENT FOR YOU 9/47
All Rights Reserved - The Good Way Publishing - 2010
http://www.the-good-way.com
of person he


So I thought this would be easy to resolve by adding "com" to the end
of my expression:
MY GRACE[a-zA-Z0-9/ ^13\-:.]{11,122}.com


thus limiting the find at that point. But that expression is not found
at all, which totally stumps me. I would appreciate any insight into
this.
I'm in Word 03 on Windows XP.


Thanks,
p.