Help with regexp ?

Jan 19, 2012 at 2:02am

Help with regexp ?

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

‘c:blabla8 bla’ into

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 !

Jan 19, 2012 at 2:31am

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?

Jan 19, 2012 at 2:56am

take a look at [combine].

Jan 19, 2012 at 3:15am

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?

Jan 19, 2012 at 4:45am

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

Jan 19, 2012 at 11:12am

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.

Jan 19, 2012 at 2:22pm

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?

Jan 19, 2012 at 8:55pm

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

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


You must be logged in to reply to this topic.