View Single Post
  #3   Report Post  
Posted to microsoft.public.word.newusers
Klaus Linke Klaus Linke is offline
external usenet poster
 
Posts: 413
Default Help with wildcard search, please?

"Ed" wrote:
I'm trying to use Find (Ctrl+F) with wildcards to find a certain string
ending in a number between 60 and 81. I tried
(App A, Item No. )([60-81]{2})
but it found "App A, Item No. 10". I looked on the Word FAQ page for
Wildcards, but couldn't find how to restrict the number to "more than this
but less than that".

Can this be done with Find, or do I need to go into VBA?



Hi Ed,

Wildcards deal with patterns, and don't have any built-in concept of
numbers. You probably need VBA.

You could use a wildcard search first to find numbers between 60 and 89
([6-8][0-9]), and then you'd need to check the number (last two characters
in the selection) with VBA:

Select Case Val(Right(Selection.Text,2))
Case 60 to 81
' match
End Select

For wildcards to work in this case, you would need an "OR" operator, which
does not exist in Word wildcards:
[6][0-9] OR [7][0-9] OR [8][0-1]

Regards,
Klaus