Solved

HT replace period-followed-by-leter with period-space-space-letter? (Word 2010)

Posted on 2012-03-15
6
235 Views
Last Modified: 2012-03-16
I have a huge document that got pasted out of another source.  Many of the sentences have no spaces between the period at the end of one sentence, and the first letter of the first word in the next sentence.  Is there a way to use search & replace to locate them and insert two spaces between the sentences?

Thanks for any help-
0
Comment
Question by:ottenm
  • 2
  • 2
  • 2
6 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37728677
Why don't you simply use a search/replace with

"."
replaced by
".  "
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37728681
Later you might like to replace

".  "
replaced by
".   "
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 37728923
Yes you need at least two Find and Replace operations to be sure of getting two and exactly two spaces.. If you use Wildcards, you can make sure that you are finding a full stop, and not a decimal point.

1 No spaces at the moment
Find:     .([A-Z]{1,})
Replace:  .  \1

Open in new window

2.Some spaces at the moment
Find:     .[ ]{1,}([A-Z]{1,})
Replace:  .  \1

Open in new window


Or you can do it with a VBA macro:
Sub TwoSpaces()
    With ActiveDocument.Range.Find
        .MatchWildcards = True
        .Text = ".([A-Z]{1,})" 'no current space followed by a capital letter
        .Replacement.Text = ".  \1"
        .Execute Replace:=wdReplaceAll
        .Text = ".[ ]{1,}([A-Z]{1,})" 'one or more current spaces
        .Execute Replace:=wdReplaceAll
    End With
End Sub

Open in new window

0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:ottenm
ID: 37731088
Thanks for the replies.  ssaqibh, I can't do "." with ". " because there are a number of places that already have 1 or 2 spaces.

GrahamSkan, I can't get word to find a match using the regexp.  I copied one of them into the search/replace dialog, but no matches found.  I tried the other one in the navigation/search, and created a doc with dots, spaces and letters (also shown in the snap).  Is there a trick to entering regexp's into those dialogs?  

Thanks for any help-
0
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 500 total points
ID: 37731112
Have you ticked the 'Use wildcards' checkbox? It's visible if you click the 'More>>' button.
0
 

Author Comment

by:ottenm
ID: 37731120
So polite!!  I had no idea it was my turn to be an idiot.

Well, now that that's out of the way.

Thanks a million GrahamSkan, worked like a charm!!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question