filtering repetitions of spaces

Nov 13, 2008 at 2:15pm

filtering repetitions of spaces

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?

http://www.cycling74.com/story/2008/6/2/161813/1326

Thanks.

#40826
Nov 13, 2008 at 2:17pm

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

Look at this patch:

– Pasted Max Patch, click to expand. –

Cheers.

#144857
Nov 13, 2008 at 2:30pm

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

– Pasted Max Patch, click to expand. –
#144858
Nov 13, 2008 at 3:39pm

Thanks! That’s great!

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

#144859
Nov 14, 2008 at 12:56am

> 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 “

#144860
Nov 14, 2008 at 12:02pm

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

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

– Pasted Max Patch, click to expand. –


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

#144861
Nov 14, 2008 at 12:56pm

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 “

#144862
Nov 14, 2008 at 1:08pm

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

#144863

You must be logged in to reply to this topic.