How to build the search string to find numbers from 75 to 99?

R

Robix

Hi,

I do not know if this is the right group to post this message.
I needed to search for the numbers between 75 and 99. I built 2 search
strings using wildcards (I am not using VBScript regular expressions). One
for numbers from 75 to 79, and the second for the numbers from 80 to 99. It
works fine. Anyway, I wonder if it is possible to build one search string
that would find numbers between 75 and 99 using wildcards.


Thank you very much.
Regards,
Robert
 
D

Dave Lett

Hi Robert,

You can iterate through the numbers and do it with the following:

Dim iNum As Integer
Dim iLoop As Integer

iNum = 75

With Selection
.HomeKey Unit:=wdStory
For iLoop = 1 To 100 - 75
With .Find
.Text = CStr(iNum)
.MatchWholeWord = True
With .Replacement
.ClearFormatting
.Font.Bold = True
End With
.Execute Replace:=wdReplaceAll
End With
iNum = iNum + 1
Next iLoop
End With

If you have your heart set on wildcards, then you can use something like the
following:

With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Text = "<[7][5-9]>"
.MatchWildcards = True
With .Replacement
.ClearFormatting
.Font.Bold = True
End With
.Execute Replace:=wdReplaceAll

.Text = "<[8-9][0-9]>"
.Execute Replace:=wdReplaceAll
End With
End With

HTH,
Dave
 
R

Robix

Hi Dave,

Thank you for your code.
I created exactly the same search strings using wildcards (one for 75 to 79,
another one for 80 to 99). But I wonder if those two search strings can be
put together in just one search string covering numbers between 75 and 99. I
tried to use vertical bar | to create a condition, but it does not seem to
work with wildcards. Vertical bar seems to have no special meaning in
wildcards.

Can you advise on this?
Regards,
Robert

Dave Lett said:
Hi Robert,

You can iterate through the numbers and do it with the following:

Dim iNum As Integer
Dim iLoop As Integer

iNum = 75

With Selection
.HomeKey Unit:=wdStory
For iLoop = 1 To 100 - 75
With .Find
.Text = CStr(iNum)
.MatchWholeWord = True
With .Replacement
.ClearFormatting
.Font.Bold = True
End With
.Execute Replace:=wdReplaceAll
End With
iNum = iNum + 1
Next iLoop
End With

If you have your heart set on wildcards, then you can use something like
the
following:

With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Text = "<[7][5-9]>"
.MatchWildcards = True
With .Replacement
.ClearFormatting
.Font.Bold = True
End With
.Execute Replace:=wdReplaceAll

.Text = "<[8-9][0-9]>"
.Execute Replace:=wdReplaceAll
End With
End With

HTH,
Dave


Robix said:
Hi,

I do not know if this is the right group to post this message.
I needed to search for the numbers between 75 and 99. I built 2 search
strings using wildcards (I am not using VBScript regular expressions).
One
for numbers from 75 to 79, and the second for the numbers from 80 to 99. It
works fine. Anyway, I wonder if it is possible to build one search string
that would find numbers between 75 and 99 using wildcards.


Thank you very much.
Regards,
Robert
 
K

Klaus Linke

Hi Robin,

You're right: "or" (|) is missing from Word's wildcard repertoire.

You can tell Microsoft that you'd like this feature with a mail/post to MSWish:
http://register.microsoft.com/mswish/suggestion.asp
or post it as a "suggestion" on the web interface to these newsgroups:
http://www.microsoft.com/office/community/en-us/FlyoutOverview.mspx#13
(Passport needed; MS empoyees look at suggestions and reply to a [very] few).

Greetings,
Klaus




Robix said:
Hi Dave,

Thank you for your code.
I created exactly the same search strings using wildcards (one for 75 to 79,
another one for 80 to 99). But I wonder if those two search strings can be
put together in just one search string covering numbers between 75 and 99. I
tried to use vertical bar | to create a condition, but it does not seem to
work with wildcards. Vertical bar seems to have no special meaning in
wildcards.

Can you advise on this?
Regards,
Robert

Dave Lett said:
Hi Robert,

You can iterate through the numbers and do it with the following:

Dim iNum As Integer
Dim iLoop As Integer

iNum = 75

With Selection
.HomeKey Unit:=wdStory
For iLoop = 1 To 100 - 75
With .Find
.Text = CStr(iNum)
.MatchWholeWord = True
With .Replacement
.ClearFormatting
.Font.Bold = True
End With
.Execute Replace:=wdReplaceAll
End With
iNum = iNum + 1
Next iLoop
End With

If you have your heart set on wildcards, then you can use something like
the
following:

With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Text = "<[7][5-9]>"
.MatchWildcards = True
With .Replacement
.ClearFormatting
.Font.Bold = True
End With
.Execute Replace:=wdReplaceAll

.Text = "<[8-9][0-9]>"
.Execute Replace:=wdReplaceAll
End With
End With

HTH,
Dave


Robix said:
Hi,

I do not know if this is the right group to post this message.
I needed to search for the numbers between 75 and 99. I built 2 search
strings using wildcards (I am not using VBScript regular expressions).
One
for numbers from 75 to 79, and the second for the numbers from 80 to 99. It
works fine. Anyway, I wonder if it is possible to build one search string
that would find numbers between 75 and 99 using wildcards.


Thank you very much.
Regards,
Robert
 
R

Robix

Hi Klaus,

Thank you for the confirmation on vertical bar.
As for the posting it to MS, I will think about :) I'm sure I not the first
man who misses it.

Regards,
Robert

Hi Robin,

You're right: "or" (|) is missing from Word's wildcard repertoire.

You can tell Microsoft that you'd like this feature with a mail/post to
MSWish:
http://register.microsoft.com/mswish/suggestion.asp
or post it as a "suggestion" on the web interface to these newsgroups:
http://www.microsoft.com/office/community/en-us/FlyoutOverview.mspx#13
(Passport needed; MS empoyees look at suggestions and reply to a [very]
few).

Greetings,
Klaus




Robix said:
Hi Dave,

Thank you for your code.
I created exactly the same search strings using wildcards (one for 75 to
79,
another one for 80 to 99). But I wonder if those two search strings can be
put together in just one search string covering numbers between 75 and 99.
I
tried to use vertical bar | to create a condition, but it does not seem to
work with wildcards. Vertical bar seems to have no special meaning in
wildcards.

Can you advise on this?
Regards,
Robert

Dave Lett said:
Hi Robert,

You can iterate through the numbers and do it with the following:

Dim iNum As Integer
Dim iLoop As Integer

iNum = 75

With Selection
.HomeKey Unit:=wdStory
For iLoop = 1 To 100 - 75
With .Find
.Text = CStr(iNum)
.MatchWholeWord = True
With .Replacement
.ClearFormatting
.Font.Bold = True
End With
.Execute Replace:=wdReplaceAll
End With
iNum = iNum + 1
Next iLoop
End With

If you have your heart set on wildcards, then you can use something like
the
following:

With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Text = "<[7][5-9]>"
.MatchWildcards = True
With .Replacement
.ClearFormatting
.Font.Bold = True
End With
.Execute Replace:=wdReplaceAll

.Text = "<[8-9][0-9]>"
.Execute Replace:=wdReplaceAll
End With
End With

HTH,
Dave


Robix said:
Hi,

I do not know if this is the right group to post this message.
I needed to search for the numbers between 75 and 99. I built 2 search
strings using wildcards (I am not using VBScript regular expressions).
One
for numbers from 75 to 79, and the second for the numbers from 80 to
99. It
works fine. Anyway, I wonder if it is possible to build one search
string
that would find numbers between 75 and 99 using wildcards.


Thank you very much.
Regards,
Robert
 
K

Klaus Linke

Sure. In theory, the more people request a feature, the more likely the dev team is to pick that up...

Regards,
Klaus


Robix said:
Hi Klaus,

Thank you for the confirmation on vertical bar.
As for the posting it to MS, I will think about :) I'm sure I not the first
man who misses it.

Regards,
Robert

Hi Robin,

You're right: "or" (|) is missing from Word's wildcard repertoire.

You can tell Microsoft that you'd like this feature with a mail/post to
MSWish:
http://register.microsoft.com/mswish/suggestion.asp
or post it as a "suggestion" on the web interface to these newsgroups:
http://www.microsoft.com/office/community/en-us/FlyoutOverview.mspx#13
(Passport needed; MS empoyees look at suggestions and reply to a [very]
few).

Greetings,
Klaus




Robix said:
Hi Dave,

Thank you for your code.
I created exactly the same search strings using wildcards (one for 75 to
79,
another one for 80 to 99). But I wonder if those two search strings can be
put together in just one search string covering numbers between 75 and 99.
I
tried to use vertical bar | to create a condition, but it does not seem to
work with wildcards. Vertical bar seems to have no special meaning in
wildcards.

Can you advise on this?
Regards,
Robert

Dave Lett said:
Hi Robert,

You can iterate through the numbers and do it with the following:

Dim iNum As Integer
Dim iLoop As Integer

iNum = 75

With Selection
.HomeKey Unit:=wdStory
For iLoop = 1 To 100 - 75
With .Find
.Text = CStr(iNum)
.MatchWholeWord = True
With .Replacement
.ClearFormatting
.Font.Bold = True
End With
.Execute Replace:=wdReplaceAll
End With
iNum = iNum + 1
Next iLoop
End With

If you have your heart set on wildcards, then you can use something like
the
following:

With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Text = "<[7][5-9]>"
.MatchWildcards = True
With .Replacement
.ClearFormatting
.Font.Bold = True
End With
.Execute Replace:=wdReplaceAll

.Text = "<[8-9][0-9]>"
.Execute Replace:=wdReplaceAll
End With
End With

HTH,
Dave


Hi,

I do not know if this is the right group to post this message.
I needed to search for the numbers between 75 and 99. I built 2 search
strings using wildcards (I am not using VBScript regular expressions).
One
for numbers from 75 to 79, and the second for the numbers from 80 to
99.
It
works fine. Anyway, I wonder if it is possible to build one search
string
that would find numbers between 75 and 99 using wildcards.


Thank you very much.
Regards,
Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top