Help with regexp ?

djlbe's icon

I know there is a god right who know how to use regexp for transform something like :

'c:blabla8 bla' into
'c:blabla8bla'

It's late and that's the last things I need to do on my patch for today : )

That's maybe stupid but I use an object join which receive two symbols, I use it for banging it after like with a 'i' or a 'f' but with symbol. the prob is that 'join' create a space between this two symbols... I know sprintf but his first inlet output directly when it receive a message.

thanks in advance !

woyteg's icon

you could use sprintf anyways if you just send the final bla-sequence generated into a messagebox and bang it out when it's done, right?

11OLSEN's icon

take a look at [combine].

djlbe's icon

haha woyteg, that was stupid, thank u ! : ) but [combine] doesn't work ? I mean it out directly when it receive a message in first inlet ? there is a way for avoid that with it?

woyteg's icon

edit: that was plain wrong, i go to sleep now

Luke Hall's icon

If you have two separate messages then a combination of [sprintf %s%s] and [zl reg] should do the trick here, the first for combining the strings without a space, the second for storing the new string (right inlet) until you receive a "bang" (left inlet).

If the string is one message already (it's hard to tell from the example you give) then [regexp (\s) @substitute %0] should remove the space and you can use [zl reg] again as in the explanation above to hold on to the result just like you would do with [i] or [f] for ints and floats.

djlbe's icon

Luke, woyteg was right with his solution and I think zl reg should work also. for the regexp (I'm curious of this object cause it's seems really powerful) what i would like to do is for all ' ' => '' at the place of delete all the space which is not my goal cause i could have space in the name of my folders of my files when it's impossible to have ' ' in a path. did u know a way for doing this with regexp?

mzed's icon

Does [regexp "/ " @substitute /] work for you?

I'm using / for the path separator, because that's how max does it.