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

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.
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Wildcard problem

Depending upon what else is in the document you could search for
MY GRACE *way.com

see http://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 site www.gmayor.com
Word MVP web site http://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.



  #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.


  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Tony Jollans[_2_] Tony Jollans[_2_] is offline
external usenet poster
 
Posts: 4
Default Wildcard problem

The reason it didn't work is that the characters ., c, o, and m are all
matched within the existing pattern and, after Word has found up to 122 of
them, it does not then find .com. Word's wildcard pattern matching is not a
full RegEx, and it isn't looking ahead for .com.

--
Enjoy,
Tony

www.WordArticles.com

"Paul B." wrote in message
...
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.


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

Thanks Tony. In my mind, I told Word to find the 122 characters in the
bracketed class, and then go on to find the .com. But I guess Word
doesn't agree, and it gets the final say. I don't believe PERL
RegEx's, which I'm more used to, work that way.

p.

On Aug 10, 11:07*am, "Tony Jollans" wrote:
The reason it didn't work is that the characters ., c, o, and m are all
matched within the existing pattern and, after Word has found up to 122 of
them, it does not then find .com. Word's wildcard pattern matching is not a
full RegEx, and it isn't looking ahead for .com.

--
Enjoy,
Tony

*www.WordArticles.com

"Paul B." wrote in message

...
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.




  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Tony Jollans[_2_] Tony Jollans[_2_] is offline
external usenet poster
 
Posts: 4
Default Wildcard problem

I don't know Perl, but I'm quite sure its Regexes are different. If you know
RegEx, you can use them in Word by instantiating a VBScript.RegExp object.

--
Enjoy,
Tony

www.WordArticles.com

"Paul B." wrote in message
...
Thanks Tony. In my mind, I told Word to find the 122 characters in the
bracketed class, and then go on to find the .com. But I guess Word
doesn't agree, and it gets the final say. I don't believe PERL
RegEx's, which I'm more used to, work that way.

p.

On Aug 10, 11:07 am, "Tony Jollans" wrote:
The reason it didn't work is that the characters ., c, o, and m are all
matched within the existing pattern and, after Word has found up to 122 of
them, it does not then find .com. Word's wildcard pattern matching is not
a
full RegEx, and it isn't looking ahead for .com.

--
Enjoy,
Tony

www.WordArticles.com

"Paul B." wrote in message

...
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.


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

I had no idea that is possible. I'll have to look into that. Thanks
much.

p.

On Aug 10, 1:37*pm, "Tony Jollans" wrote:
I don't know Perl, but I'm quite sure its Regexes are different. If you know
RegEx, you can use them in Word by instantiating a VBScript.RegExp object..

--
Enjoy,
Tony

*www.WordArticles.com

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wildcard replace problem kennyja New Users 0 February 4th 11 09:30 PM
\n wildcard viensdansmavie Microsoft Word Help 5 September 14th 09 01:09 AM
wildcard(\nt\%( ,\nt\% )) Narendra Boga Microsoft Word Help 2 October 12th 07 01:36 PM
Wildcard problem with ordinals Dave Logan Microsoft Word Help 3 May 12th 07 07:07 AM
Using a Wildcard Steved Microsoft Word Help 4 May 30th 05 08:33 PM


All times are GMT +1. The time now is 12:00 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"