Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Wildcard replace problem | New Users | |||
\n wildcard | Microsoft Word Help | |||
wildcard(\nt\%( ,\nt\% )) | Microsoft Word Help | |||
Wildcard problem with ordinals | Microsoft Word Help | |||
Using a Wildcard | Microsoft Word Help |