Another Find-and-Replace question. Help appreciated

B

Bert Coules

I have a document in Courier New in which some sentences are separated by
two spaces after the full stop and some by one.

I want to reformat it so that *all* full stops are followed by two spaces,
but I can't work out how to do it. I can't simply search for "full stop +
space" and replace with "full stop + two spaces" because the sentences that
are already separated by two spaces will end up with three.

Is there a wild character which represents "a character but not a space"?

The only other way I've thought of is to replace both "full stop + space"
and "full stop + two spaces" with just "full stop", and then replace "full
stop" with "full stop + two spaces". This strikes me as clumsy and
inelegant, but I suppose it should work. But surely there's a better way?

Many thanks.

Bert
 
R

Reitanos

There's probably a smarter way, but why not replace ". " (period
single) with ". " (period double) and then replace all " " (triple)
with " " (double) twice.
Don't forget question and exclamation marks as well.
 
B

Bert Coules

Reitanos said:
There's probably a smarter way, but why not replace ". " (period
single) with ". " (period double) and then replace all " " (triple)
with " " (double) twice.

Thanks for that. It does seem more elegant than my suggestion.
Don't forget question and exclamation marks as well.

I had! Thanks.

Bert
 
T

tedmi

^w will match any number of consecutive spaces and/or tabs.
So replace .^w with . space space; repeat for !, ?
 
G

Graham Mayor

You could also use a wildcard search for

([.:\?\!])([ ]){1,}
replace with
\1\2\2

which should do the lot at once. However you would have to handle the
behaviour where quotes are involved separately.
See http://www.gmayor.com/replace_using_wildcards.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
B

Bert Coules

Graham,

Thanks for that, and for the link. In this particular instance I've now
achieved what I needed by inelegant (but successful) means, but it's bound
to crop up again.

Bert
 

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