Solved

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

Posted on 2012-03-15
6
239 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

 

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

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

756 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