Solved

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

Posted on 2012-03-15
6
230 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
Comment Utility
Why don't you simply use a search/replace with

"."
replaced by
".  "
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
Comment Utility
Later you might like to replace

".  "
replaced by
".   "
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
Comment Utility
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:ottenm
Comment Utility
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
Comment Utility
Have you ticked the 'Use wildcards' checkbox? It's visible if you click the 'More>>' button.
0
 

Author Comment

by:ottenm
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
*Best* PDF to Word Convertor 4 79
Break numbering between parenthesis into a new line 32 47
help with flyer 3 41
Word - Access 3 28
When creating Microsoft Word-based forms there may be a need to have a form field repeated throughout the whole document. For instance, with a company name, you may want this information repeated automatically throughout the document rather than man…
I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now