Find & Replace Question

G

Guest

I have a bunch of documents that I am trying to do a find and replace on. The
problem is that they have words with various spaces after them and I want to
deleted the spaces and put in an underline. Examples are like the following:

Torque (with 5 spaces)
Torque (with 8 spaces)

And I want it to look like this

Torque _________

Is there a wildcard that will find the spaces?
 
J

Jay Freedman

Use the code ^w to find any number of consecutive spaces and tabs. (This
is also available by clicking More and then Special, and choosing "White
Space".) So in the Find What box enter

Torque^w

and in the Replace With box enter

Torque _________

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

Guest

Thanks Jay, that worked when I ran it.

One thing I didn't realize on some of the words is that they are not all the
same. See the follow:

Wrench ID (with spacing)
Wrench ID#(with spacing)
Wrench ID#:(with spacing)
and so on......

As you can see its in there many different ways. How do I capture all the
variuos ways its in there so I can run the Find & Replace only once?
 
J

Jay Freedman

For that you need a real "wildcard" search, as described at
http://www.gmayor.com/replace_using_wildcards.htm. (The ^w code isn't
considered a wildcard in a Word search.)

To make that work, first click the More button and check the box for "Use
wildcards".

You'll have to do this in two passes, because Word's wildcards can express
"one or more of this character" but they can't say "zero or more of this
character". The first pass is a wildcard search for

Find what: [#:b]{1,}
Replace with: b_______

(where I used the letter b to represent a blank). Then you'll have to follow
that with a non-wildcard search for

Find what: #b_
Replace with: b_

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

Guest

Thanks that did the job.



Jay Freedman said:
For that you need a real "wildcard" search, as described at
http://www.gmayor.com/replace_using_wildcards.htm. (The ^w code isn't
considered a wildcard in a Word search.)

To make that work, first click the More button and check the box for "Use
wildcards".

You'll have to do this in two passes, because Word's wildcards can express
"one or more of this character" but they can't say "zero or more of this
character". The first pass is a wildcard search for

Find what: [#:b]{1,}
Replace with: b_______

(where I used the letter b to represent a blank). Then you'll have to follow
that with a non-wildcard search for

Find what: #b_
Replace with: b_

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
Thanks Jay, that worked when I ran it.

One thing I didn't realize on some of the words is that they are not
all the same. See the follow:

Wrench ID (with spacing)
Wrench ID#(with spacing)
Wrench ID#:(with spacing)
and so on......

As you can see its in there many different ways. How do I capture all
the variuos ways its in there so I can run the Find & Replace only
once?
 

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