Group:  Microsoft Word » microsoft.public.word.newusers
Thread: Another Find-and-Replace question. Help appreciated

Geek News

Another Find-and-Replace question. Help appreciated
"Bert Coules" <mail[ at ]bertcoules.co.uk> 10/22/2008 7:15:49 PM
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







Re: Another Find-and-Replace question. Help appreciated
Reitanos <reitanospa1[ at ]yahoo.com> 10/22/2008 7:24:37 PM
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.

On Oct 22, 3:15 pm, "Bert Coules" <m...[ at ]bertcoules.co.uk> wrote:
[Quoted Text]
> 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

Re: Another Find-and-Replace question. Help appreciated
"Bert Coules" <mail[ at ]bertcoules.co.uk> 10/22/2008 7:29:23 PM
Reitanos wrote:

[Quoted Text]
> 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


RE: Another Find-and-Replace question. Help appreciated
tedmi 10/22/2008 8:52:04 PM
^w will match any number of consecutive spaces and/or tabs.
So replace .^w with . space space; repeat for !, ?
--
TedMi

"Bert Coules" wrote:

[Quoted Text]
> 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
>
>
>
>
>
>
>
>
Re: Another Find-and-Replace question. Help appreciated
"Bert Coules" <mail[ at ]bertcoules.co.uk> 10/22/2008 11:13:34 PM
TedMi wrote:

[Quoted Text]
> ^w will match any number of consecutive spaces and/or tabs.

That's very useful, thanks.

Bert


Re: Another Find-and-Replace question. Help appreciated
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 10/23/2008 6:58:36 AM
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

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


Bert Coules wrote:
[Quoted Text]
> TedMi wrote:
>
>> ^w will match any number of consecutive spaces and/or tabs.
>
> That's very useful, thanks.
>
> Bert


Re: Another Find-and-Replace question. Help appreciated
"Bert Coules" <mail[ at ]bertcoules.co.uk> 10/23/2008 8:08:35 AM
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


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net