View Single Post
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word find/replace equivalent of (word1|word2)

If the words are bracketed as shown then
\([a-zA-Z]{2,}|[a-zA-Z]{2,}\)
will find them
If the words are not bracketed use
[a-zA-Z]{2,}|[a-zA-Z]{2,}
These will find the whole string. Depending upon what you want to do with
the string having found it determines whether anything else needs to be
added.
See http://www.gmayor.com/replace_using_wildcards.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org





Hikari wrote:
Hello All,

New poster, I did my best to search for this answer using keywords
such as: atomic grouping, alternatives, bar OR pip equivalent, etc...
but had no luck

My question is, is there/what is the Microsoft Word find/replace
equivalent of the regular expression

(word1|word2)

?

I've obviously tried | and \| with no luck. And any webpage I found
with discussion of advanced find/replace for word did not go into
atomic grouping.

Thanks so much!

-Hikari