Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

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

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
ottenm
Asked:
ottenm
  • 2
  • 2
  • 2
2 Solutions
 
Saqib Husain, SyedEngineerCommented:
Why don't you simply use a search/replace with

"."
replaced by
".  "
0
 
Saqib Husain, SyedEngineerCommented:
Later you might like to replace

".  "
replaced by
".   "
0
 
GrahamSkanCommented:
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
ottenmAuthor Commented:
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
 
GrahamSkanCommented:
Have you ticked the 'Use wildcards' checkbox? It's visible if you click the 'More>>' button.
0
 
ottenmAuthor Commented:
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now