filtering repetitions of spaces

fairesigneaumachiniste's icon

I have a string like this:

"some text with lots of spaces"

I want it to be changed to:

"some text with lots of spaces"

I know the object I want is regexp and I know that I need to say:

'Look for all spaces followed by any number of spaces and replace with one space'

but I can't seem to write it out correctly.

I had a look at this but still struggling. Can someone point me in the right direction?

Thanks.

fairesigneaumachiniste's icon

That didn't work as the forum filters out repetitions on spaces anyway.

Look at this patch:

Max Patch
Copy patch and select New From Clipboard in Max.

Cheers.

Emmanuel Jourdan's icon

On 13 nov. 08, at 15:17, fairesigneaumachiniste wrote:

> That didn't work as the forum filters out repetitions on spaces
> anyway.

Something like that should do it.

ej

Max Patch
Copy patch and select New From Clipboard in Max.

fairesigneaumachiniste's icon

Thanks! That's great!

I also found that doing [fromsymbol] - [tosymbol] worked but definitely not the best way.

jayrope's icon

> That didn't work as the forum filters out repetitions on spaces
> anyway.

shortening multiple spaces into one is actually just a simple html feature, unless you explicitly write a "

Tj Shredder's icon

Emmanuel Jourdan schrieb:
> Something like that should do it.

yes, why easy if you can have it complicated... ;-)

Max Patch
Copy patch and select New From Clipboard in Max.

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com

fairesigneaumachiniste's icon

Quote: jayrope wrote on Fri, 14 November 2008 01:56
----------------------------------------------------
> > That didn't work as the forum filters out repetitions on spaces
> > anyway.
>
> shortening multiple spaces into one is actually just a simple html feature, unless you explicitly write a "

jayrope's icon

when writing javascript (or any code actually) you should use a dedicated code editor to strip out unwanted carriage returns, line breaks, tabs, spaces, etc.
a normal text software (like word) will unintentionally create those while you type, unless you set it to plain text edit (.txt) without any further visual formatting options.

i guess you knew this already?

i can recommend bbedit strongly for this (on mac).

jrp