Home » Questions » Computers [ Ask a new question ]

How to remove more than one space from selected text?

How to remove more than one space from selected text?

for example

Asked by: Guest | Views: 98
Total answers/comments: 2
Guest [Entry]

"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."
Guest [Entry]

"You can use the find and replace feature in word.

In 2003:

go to the ""Edit"" menu
Choose ""Replace""
In ""Find What"", type two spaces
In ""Replace With"" type one space
Then click ""Replace All"""