Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

for example

this ( see space between word, space after fullstop and space before fullstip)

We prefer questions that    can be answered, not just discussed.    We prefer questions that can be answered, not just   discussed  .   We prefer   questions that can be answered, not just discussed   .

to this

We prefer questions that can be answered, not just discussed. We prefer questions that can be answered, not just discussed. We prefer questions that can be answered, not just discussed.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

AHK has regex support - as such, a quick expression:

^!v::
clipboard:=ClipboardAll
output:=RegexReplace(clipboard, "\s\s+", " ")
output:=RegexReplace(output, "\s([.])", "$1")
sendraw %output%
Return

This hotkey fires on Control-Alt-V. The ^ is control, the ! is alt, and the v is, well, v. Easy to change if you'd like something that doesn't require two hands :)

Hardcoding the . in isn't exactly elegant.
The proof: We prefer questions that can be answered, not just discussed. We prefer questions that can be answered, not just discussed. We prefer questions that can be answered, not just discussed.

Edit: There, AHK does support $1. That ([.]) means "match any of the characters within the []s (in this case... just .), and the brackets mean store what it finds, so it can output it for the $1. The upshot of this is that if you stick other punctuation marks inside that [], they'll be auto-despaced too.

share|improve this answer
    
how to use this script , i mean what is keyboard shortcut? –  metal gear solid Jan 9 '10 at 17:19
    
Control(^) Alt(!) v(v). Sorry for not making that clear - I assumed you were used to using AHK, as it was tagged in the question. I'll edit my answer :) –  Phoshi Jan 9 '10 at 17:28
    
good working , but it rewrote whole text again. –  metal gear solid Jan 9 '10 at 17:35
    
Sendraw does that, yeah. You can change the timing with SetKeyDelay, but there's no real need. –  Phoshi Jan 9 '10 at 17:47

you could use notepad, and replace two spaces with one. :)

share|improve this answer
    
That's how I usually do it. Then just keep doing it until none are found. Simple concept that works in just about any editor that has search & replace. ;) I +1'd you for suggesting Notepad when it was plain text that was presented in the question. –  Ƭᴇcʜιᴇ007 Jan 9 '10 at 21:17

You can use the find and replace feature in word.

In 2003:

  1. go to the "Edit" menu
  2. Choose "Replace"
  3. In "Find What", type two spaces
  4. In "Replace With" type one space
  5. Then click "Replace All"
share|improve this answer
    
Does it hang around afterwards? If so, a couple of presses would work for 3+ spaces! –  Phoshi Jan 9 '10 at 15:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.