replace three spaces between sentences with two spaces

M

mack

In word 2004, I have three spaces between sentences and I need two
spaces only.

In Find and Replace, I used "any letter" from the special character
menu then "full stop". This found the full stops at the end of words.

Then I put "find what text" in the replace box (^&)

Problem: three spaces between sentences instead of two.

What I WANT to put there is "any letter", "full stop" then type two
spaces on the spacebar, and then "any letter", BUT word won't let
me--"any letter" is not valid for the replace box.

Can someone please tell me what I should type in the replace box
please? Thank you.
 
E

Elliott Roper

mack said:
In word 2004, I have three spaces between sentences and I need two
spaces only.

In Find and Replace, I used "any letter" from the special character
menu then "full stop". This found the full stops at the end of words.

Then I put "find what text" in the replace box (^&)

Problem: three spaces between sentences instead of two.

What I WANT to put there is "any letter", "full stop" then type two
spaces on the spacebar, and then "any letter", BUT word won't let
me--"any letter" is not valid for the replace box.

Can someone please tell me what I should type in the replace box
please? Thank you.
With wildcards enabled:-
Find: "([a-z]). ([A-Z])"
Replace "\1. \2"
both without the " characters of course.
Read the wildcard help for why.
Note that I chose lower case alphabetic before the period and upper
case after to better distinguish sentence ends.
If you want both, use [a-z],[A-Z] as the 'any letter' match expression.
 
X

Xenocog

Hi Mack, If I understand the problem correctly, you could put three
spaces in the "Find" part of the window and two spaces in the "Replace
With" window. It would only replace spaces where there are three.

Also, when using a proportional-spaced font, only one space is required
(unless a teacher, boss, etc. has different views). The old 2-space
idea comes from typewriters with their mono-spaced fonts to help the
eye distinguish the ends of sentences. With word processors, the spaces
take care of themselves.

Hope this helps,
xenocog
 
B

Beth Rosengard

It's so nice to have you back in force, Elliot! I've really been missing my
daily ER chuckles ;-).

Beth
 
M

mack

Thank you.

Next problem: Some single-spaced sentences still exist. These seem to
be the ones with quote marks at the end. I have tried Elliot's formula
with wildcards enabled and have ALSO added a quote mark at the end:
typed in exactly: [(a-z)].' ([A-Z]) , leaving a single space between
the two. This must be wrong as it doesn't find the single spaced
sentences.

The 'three spaces'--'two spaces' also helped, thank you. I am using
courier font, and have been advised to include an extra space to make
the editor's life easier.
 
X

Xenocog

Hi Mack,
The easiest way I can think of to change one space to two is a bit
"around the elbow" but should work.

1. In Find and Replace, put a period followed by one space in "Find"
and a period followed by two spaces in "Replace." HIt Commmand-A to
replace all instances of period-space with period-space-space.
2. Then go back to the method of replacing three spaces with two, hit
Command-A. Repeat until Word says it has made zero replacements.

I *think* this will work...
Best of luck,
xenocog
 
E

Elliott Roper

mack said:
Thank you.

Next problem: Some single-spaced sentences still exist. These seem to
be the ones with quote marks at the end. I have tried Elliot's formula
with wildcards enabled and have ALSO added a quote mark at the end:
typed in exactly: [(a-z)].' ([A-Z]) , leaving a single space between
the two. This must be wrong as it doesn't find the single spaced
sentences.

I'll bet you all of London to a burnt match that you have or had at
some time in the past "replace straight quotes with smart quotes"
checked in one of Tools->autocorrect->auto format as you type,
autoformat, autoformat while you have another cup of tea, autoformat
when you least expect it and so on.

In that case copy one of the closing curly quote marks from your text
and paste it into the search string and try again.
 
M

mack

Thank you very much. I tried the [(a-z)] method but couldn't quite get
it to work. I wish I could use this method--would save hours. I have to
prepare another version of this same document, with two spaces between
sentences. Is there a way to do this simply from the beginning?

The problem seems to have been thet some sentences ended with a quote
mark and some with just a full stop. Also other sentences start with a
quote mark. I did try to add quote marks to Elliot's instructions, but
it didn't seem to find the text. Must be typing something wrong. I
double checked that wild cards were on, and added both sets of
brackets, and the appropriate (I hope) number of spaces between.

Not using curly quotes, as it's "courier", but I have in much earlier
versions of the document.

If I could have exactly what to type in, that should work. Sorry to
bother you.

Your help is much appreciated.
 
M

mack

Managed to find a question mark-ending sentence with "\? ([A-Z])"

In the replace box I have "\? \2" i.e. TWO space in-between.

This is obviously a no-no as the error message is "The replace with
text contains a group number which is out of range."
 
E

Elliott Roper

mack said:
Managed to find a question mark-ending sentence with "\? ([A-Z])"

In the replace box I have "\? \2" i.e. TWO space in-between.

This is obviously a no-no as the error message is "The replace with
text contains a group number which is out of range."

You are almost there. I do suggest you read the help. Then the error
message will make sense.
That replace should be \1 now, since there is only one (something)
construction in the search string.
 
E

Elliott Roper

mack said:
Thank you very much. I tried the [(a-z)] method but couldn't quite get
it to work. I wish I could use this method--would save hours. I have to
prepare another version of this same document, with two spaces between
sentences. Is there a way to do this simply from the beginning?
It really does work. Do you have wildcards turned on in the search box
(as revealed when you turn the triangle down)?
The problem seems to have been thet some sentences ended with a quote
mark and some with just a full stop. Also other sentences start with a
quote mark. I did try to add quote marks to Elliot's instructions, but
it didn't seem to find the text. Must be typing something wrong. I
double checked that wild cards were on, and added both sets of
brackets, and the appropriate (I hope) number of spaces between.

It is not difficult to create a search string that will find all
possible sentence endings that you have been sneaking up with in your
later posts. Read the help.
Not using curly quotes, as it's "courier", but I have in much earlier
versions of the document.
That may be irrelevant. Word might be putting the curly in and
substituting back when in Courier. Regardless, follow my previous
suggestion to cut a quote from the text. There is no harm in making two
passes through the doc, one curly and one straight.
If I could have exactly what to type in, that should work. Sorry to
bother you.
I have done so every time so far.
Now, if you want to detect sentences that:
end with lower case alphabetic followed by a period, any number of
spaces and then an upper case alphabetic or by any curly straight
double or single quote
and
the same with a question mark after the period
and
the same with a single straight quote mark after the period
and
the same with a single curly quote mark after the period
and
the same with a double straight quote mark after the period
and
the same with a double curly quote mark after the period
try, with wildcards enabled
([a-z.\?][²¹'"]) {1,}([""''A-Z]) that's with one each of straight and
curly single and double quotes in two places
You will have to make another pass through the document with
([a-z.\?]) {1,}([""''A-Z])
because Word's pattern match won't allow {0,} for a count on the first
[²¹'"] expression. (At least in version v.X)

I *hate* regular expressions, which is what we are dealing with here.
Word's implementation is rather broken, probably in a misguided attempt
to make it simpler.

If you have a huge document to process, I strongly suggest reading the
help *very* carefully, followed by experiments on a copy of your
document.
 
M

mack

This is what I typed in the replace box: \? \1

This is obviously wrong. Got the 'group number' routine again. Had a
look in help, but couldn't spot. Sorry. Please be patient. On the up
side, at least I have time--so take your time.
 
R

Russs

Mack,
This is close to what Elliott suggested as another way to search in one
pass; but if you learn how to record your searches into a macro after you
refine them, you can string any number of find and replacements together to
run in sequence and repeat them as needed.

In the Find box you could use:
"([a-zA-Z0-9])([.\?²¹'"]) {1,}" only one space character in this group.

Don't use the outer double quote marks in the find box. This wildcard group
finds any single alphanumeric character followed by a single punctuation
character followed by _one or more_ spaces.

In the Replacement box you would put:
"\1\2 " two trailing spaces in this group.

Again, don't include the outer double quote marks in the box. This group
says replace found text with the original two first characters followed by
two spaces only.
The wildcards checkbox must be checked.

Difficult characters can sometimes be cut and pasted into text boxes like
Elliot suggested or you may have to resort to using something like the old
ascii code numbers where ^13 is the code for the paragraph mark character.

mack said:
Thank you very much. I tried the [(a-z)] method but couldn't quite get
it to work. I wish I could use this method--would save hours. I have to
prepare another version of this same document, with two spaces between
sentences. Is there a way to do this simply from the beginning?
It really does work. Do you have wildcards turned on in the search box
(as revealed when you turn the triangle down)?
The problem seems to have been thet some sentences ended with a quote
mark and some with just a full stop. Also other sentences start with a
quote mark. I did try to add quote marks to Elliot's instructions, but
it didn't seem to find the text. Must be typing something wrong. I
double checked that wild cards were on, and added both sets of
brackets, and the appropriate (I hope) number of spaces between.

It is not difficult to create a search string that will find all
possible sentence endings that you have been sneaking up with in your
later posts. Read the help.
Not using curly quotes, as it's "courier", but I have in much earlier
versions of the document.
That may be irrelevant. Word might be putting the curly in and
substituting back when in Courier. Regardless, follow my previous
suggestion to cut a quote from the text. There is no harm in making two
passes through the doc, one curly and one straight.
If I could have exactly what to type in, that should work. Sorry to
bother you.
I have done so every time so far.
Now, if you want to detect sentences that:
end with lower case alphabetic followed by a period, any number of
spaces and then an upper case alphabetic or by any curly straight
double or single quote
and
the same with a question mark after the period
and
the same with a single straight quote mark after the period
and
the same with a single curly quote mark after the period
and
the same with a double straight quote mark after the period
and
the same with a double curly quote mark after the period
try, with wildcards enabled
([a-z.\?][²¹'"]) {1,}([""''A-Z]) that's with one each of straight and
curly single and double quotes in two places
You will have to make another pass through the document with
([a-z.\?]) {1,}([""''A-Z])
because Word's pattern match won't allow {0,} for a count on the first
[²¹'"] expression. (At least in version v.X)

I *hate* regular expressions, which is what we are dealing with here.
Word's implementation is rather broken, probably in a misguided attempt
to make it simpler.

If you have a huge document to process, I strongly suggest reading the
help *very* carefully, followed by experiments on a copy of your
document.
 
M

mack

I have done so every time so far.
Yes, thank you, much appreciated.

Now, if you want to detect sentences that:
end with lower case alphabetic followed by a period, any number of
spaces and then an upper case alphabetic or by any curly straight
double or single quote
and
the same with a question mark after the period
and
the same with a single straight quote mark after the period
and
the same with a single curly quote mark after the period
and
the same with a double straight quote mark after the period
and
the same with a double curly quote mark after the period
try, with wildcards enabled
([a-z.\?][²¹'"]) {1,}([""''A-Z]) that's with one each of straight
and
curly single and double quotes in two places

Yes, did this with wildcards enabled, couldn't find anything.

You will have to make another pass through the document with
([a-z.\?]) {1,}([""''A-Z])
because Word's pattern match won't allow {0,} for a count on the first
[²¹'"] expression.

Did this too, but it finds Names in the middle of sentences, eg.
"Bill".

It really does work. Do you have wildcards turned on in the search box
(as revealed when you turn the triangle down)?

Yes.

It is not difficult to create a search string that will find all
possible sentence endings that you have been sneaking up with in your
later posts. Read the help.

Yes, I'm up to the part where an asterisk can be used to find word
variations. tried to add the 'white space' character, to simulate an
entire sentence. Doesn't work.This seems to be the major stumbling
block.

Thank you for your patient help.
 
M

mack

Thank you so much for your kind help. I tried your search string, and
it works brilliantly, but I don't know if it's possible( I don't think
so) to write a search string that can do what I would like to find,
which is: a sentence OR multiple sentences beginning with a quote mark,
but not having a quote mark at the end. In other words, places where
find and replace activities have chopped off my quote marks.

Don't worry, I have already checked the document by hand, I was just
wondering whether it could be corrected perfectly with a search
string--I guess not.

Thank you for trying to help me. I will probably forget the following,
but I've made a note--maybe I'll have to come back sometime and look
them up:

any single alphanumeric character=([a-zA-Z0-9])

a single punctuation character =([.\?²¹'"])

one or more_ spaces={1,}"

I once recorded a macro, but it happened completely by mistake, I can
assure you--though it's a very good idea.
 
R

Russs

Mack,
See below.
On 8/27/05 6:53 AM, in article
(e-mail address removed), "mack"
<[email protected]> wrote:
I have done so every time so far.
Yes, thank you, much appreciated.

Now, if you want to detect sentences that:
end with lower case alphabetic followed by a period, any number of
spaces and then an upper case alphabetic or by any curly straight
double or single quote
and
the same with a question mark after the period
and
the same with a single straight quote mark after the period
and
the same with a single curly quote mark after the period
and
the same with a double straight quote mark after the period
and
the same with a double curly quote mark after the period
try, with wildcards enabled
([a-z.\?][²¹'"]) {1,}([""''A-Z]) that's with one each of straight
and
curly single and double quotes in two places

Yes, did this with wildcards enabled, couldn't find anything.

You will have to make another pass through the document with
([a-z.\?]) {1,}([""''A-Z])
because Word's pattern match won't allow {0,} for a count on the first
[²¹'"] expression.

Did this too, but it finds Names in the middle of sentences, eg.
"Bill".
And the methods we have come up with may also put double spaces between a
salutation and surname like Mr. Jones unless you limit your searches to two
or more spaces with the curly braces enclosing {2,} rather than one or more
spaces with the curly braces enclosing {1,} in the find box.

Or you could do another find for extra salutation space cleanup:
"([DM][rs]{1,2}). {2,}" one space character in this group

will find Mr Ms Mrs Dr with the period and two or more spaces and
replacement:

"\1. " one space character in this group, again don't use quotes

will take it out the extra spaces.
 
R

Russs

See within.
On 8/27/05 7:19 AM, in article
(e-mail address removed), "mack"
<[email protected]> wrote:
Thank you so much for your kind help. I tried your search string, and
it works brilliantly, but I don't know if it's possible( I don't think
so) to write a search string that can do what I would like to find,
which is: a sentence OR multiple sentences beginning with a quote mark,
but not having a quote mark at the end. In other words, places where
find and replace activities have chopped off my quote marks.
It would be harder to do with straight quotes, because unlike a ( or ) you
don't know which ones are to pair up. You could write a macro to count the
number or quotes and worry if you come up with an odd number rather than an
even number. With parentheses you can find (*) to highlight everything
within them. With straight quotes "*", it might chose an end quote mark to
match with a beginning quote mark.
Don't worry, I have already checked the document by hand, I was just
wondering whether it could be corrected perfectly with a search
string--I guess not.

Thank you for trying to help me. I will probably forget the following,
but I've made a note--maybe I'll have to come back sometime and look
them up:
I'm just trying to set your notes straight.
any single alphanumeric character=([a-zA-Z0-9])
[0-9] any single number
or [sjitez] means just one of the enclosed characters.
[a-z] any lower case letter
[A-Z] any Upper case letter .... The hyphen denotes a range.

The parentheses were used to create groupings that also can be back
referenced in the replacement box or more rarely in the find box by using \1
to refer whatever the first set of parentheses enclosed, \2 the second
set..., etc.
a single punctuation character =([.\?²¹'"])
The ? had to be escaped with a preceding backslash because normally a ? is a
wildcard character. See above about the parentheses.
one or more_ spaces={1,}"
Curly braces are to denote mutltiples or the previous character or grouping.
(abc){2,3} would find abcabc or abcabcabc
I once recorded a macro, but it happened completely by mistake, I can
assure you--though it's a very good idea.
This link will help you start recording macros.
In Safari you have to click on the refresh page button a couple times
sometimes to see the whole page on this particular site.
http://word.mvps.org/faqs/macrosvba/UsingRecorder.htm
 
E

Elliott Roper

And the methods we have come up with may also put double spaces between a
salutation and surname like Mr. Jones unless you limit your searches to two
or more spaces with the curly braces enclosing {2,} rather than one or more
spaces with the curly braces enclosing {1,} in the find box.

Or you could do another find for extra salutation space cleanup:
"([DM][rs]{1,2}). {2,}" one space character in this group

will find Mr Ms Mrs Dr with the period and two or more spaces and
replacement:

"\1. " one space character in this group, again don't use quotes

will take it out the extra spaces.

That's good. I would have screwed those up.

Funny thing happened in the middle of testing this stuff. Word v.X
crashed while I was trying variations of those searches. Now nothing I
have tried so far will restore the {} counting construction. It behaves
as though it is not there.

I have made a fresh doc, quit Word, logged out, rebooted, created new
normal and a new Word settings (10). I wonder if Mack's Word has been
similarly borked all this time?

I am now pis{2}ed off. ;-)
What started off as a bit of an interesting puzzle has turned into the
sort of Microsoft nightmare I like to rubbish my Windows-using mates
about. Maybe the bloat has become sentient and has taken offence?

(I am on Word v.X with all the patches 10.1.6 (040913) under OS X
10.4.2)
 
R

Russs

See below:
On 8/27/05 8:38 AM, in article 270820051338443600%[email protected], "Elliott
Roper" <[email protected]> wrote:
And the methods we have come up with may also put double spaces between a
salutation and surname like Mr. Jones unless you limit your searches to two
or more spaces with the curly braces enclosing {2,} rather than one or more
spaces with the curly braces enclosing {1,} in the find box.

Or you could do another find for extra salutation space cleanup:
"([DM][rs]{1,2}). {2,}" one space character in this group

will find Mr Ms Mrs Dr with the period and two or more spaces and
replacement:

"\1. " one space character in this group, again don't use quotes

will take it out the extra spaces.

That's good. I would have screwed those up.

Funny thing happened in the middle of testing this stuff. Word v.X
crashed while I was trying variations of those searches. Now nothing I
have tried so far will restore the {} counting construction. It behaves
as though it is not there.

I have made a fresh doc, quit Word, logged out, rebooted, created new
normal and a new Word settings (10). I wonder if Mack's Word has been
similarly borked all this time?

Sometimes my Mac Word hangs for so long that I have to force quit, if I try
to get it to find the paragraph marker ^13 using wildcards. I.e. [\^13]
which would work on a Windows Word with a plain ^13 (mac bug?!). Fortunately
\n will do a similar function but only on a Mac, I think?

I'm using version 2004 Word for Mac, so I'm not sure if the dialog boxes
look the same...but try this other method of doing the procedure.

Open the full find and replace dialog or requestor box.
Erase, if needed, and retype new Find textbox data.
Check the use wildcards checkbox, then make sure your cursor is back in the
Find textbox, not the Replacement box.
Then the "Special" button in the lower right of the dialog becomes context
sensitive to using wildcards and will list as one its choices-
"Num Occurrences"
Select that choice and {,} should insert at the cursor in your Find textbox
for use. Unfortunately the first or only number doesn't work if it is a
number zero, so don't use that within the curly braces. Also make sure that
something is preceding the braces in the Find textbox to act upon and that
there is something in the document to find with that criteria.
 

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