Wildcard Search and "OR"

M

Matthew Lock

Hello, using wildcards can I search for one word OR another? For
example I would like something like the following to work:
"apple|pear", but I can't seem to find out what the Word wildcard
equivalent of the regular expression symbol "|" is, to mean "OR".

Thanks
 
H

Helmut Weber

Hi Matthew,
Hello, using wildcards can I search for one word OR another?

No.

Workarounds are possible, depending on the task.


Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
G

Greg

This is more of an AND approach. First you look for "apple" then for
"pears"

Sub Test()
Dim myArray As Variant
Dim i As Long

myArray = Split("pears|apples", "|")

For i = 0 To UBound(myArray)
With ActiveDocument.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = myArray(i)
.Replacement.Text = "Your Text Here"
.Execute Replace:=wdReplaceAll
End With
Next
End Sub
 

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