Replace command in word

G

Garrystone

Hi, i've been trying to use the replace command in Word,but it isn'
working how I would expect. For instance, if I'm wishing to replace al
instances of the word "align" and any combinations of "align" such a
"alignment" then I assumed I need to select the wild card option
however, it isn't working correctly. I.e. I wish to replace an
instances of "align" with the same word but formatted differentl
(bold, case change, etc). However, Word finds all instances but onl
formats the "align" part of the word. So the word "alignment" woul
have two formats. Does anybody know a solution it is really annoyin
me, I've already spent 2 hours trying to sort it out?

Thanks for your help

Garr
 
J

Jay Freedman

First read http://www.gmayor.com/replace_using_wildcards.htm.

Because of a design mistake that Microsoft has never bothered to fix, you're
going to need two separate passes: one for the word by itself and another
for all other forms of the word. (The problem is that the wildcard syntax
allows you to specify "one or more of these characters" but not "zero or
more".)

First do an ordinary replacement -- whether wildcard or not doesn't
matter -- for just the word. In your example, search for "align" and replace
with the formatted word. The code ^& can be used in the Replace With box to
mean "the text found by the search".

Then do a wildcard search for the expression

align[a-z]{1,}

and again replace with the code ^& and the formatting.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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