2009/8/20 Jonathan Kaye <[email protected]>

> Hi all,
> I've written a very clunky macro for reducing all sequences of spaces > 1
> to
> a single space. It is a find/replace loop finds a sequence of 2 spaces and
> reduces it to 1 and then loops back to the beginning and repeats 10x. I do
> this 10 times since I don't know the maximum number of spaces that I'll
> need to deal with. This works fine for short documents but looping
> repeatedly through a 430 page document seems extreme. Sure there's some
> really cool code out there that will just take an arbitrary number of
> spaces greater than 1 and reduce them to a single space.
>
> All suggestions are welcome.
> TIA
> Jonathan


In the Find & Replace dialogue click "More options" and then check Regular
Expressions. Now, in the Find box, enter "  *" without the quotes. That is 2
spaces followed by an asterisk. Enter a single space into the "Replace with"
box and click "Replace all". That should do it. What you have done is
replaced "a single space followed by zero or more spaces" with "a single
space". Read up about Regular Expressions for details. Your time doing that
will be well spent :-)


-- 
Harold Fuchs
London, England
Please reply *only* to [email protected]

Reply via email to