Harold Fuchs wrote:

> 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 :-)
> 
> 
Thanks Harold. I'll try that. What fooled me what that I took regular
expression seriously and tried \s* on the OOo search/replace, with regular
expression ticked but all it did was find "s" so I now know why OOo doesn't
recognise \s and it's because I can use " " literally combined with * in
the normal regexp manner. Cool :)

My solution was to use the altSearch extension suggested by Uwe in the
earlier thread. It works but, as I said before, it's pretty slow compared
with native OOo stuff. Your method is also better because I can now comine
that in one humongous macro that combines ALL the post mail-merge tidying
up. I'll have another posting about at least one bug that I think I found
in mail merge.
Now I'm off to try out your idea!
cheers,
Jonathan 
-- 
Registerd Linux user #445917 at http://counter.li.org/
Please do not send me copies of list mail. I read the lists. Thanks!


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to