Forums > MaxMSP

Help with regexp ?

January 19, 2012 | 2:02 am

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 !


January 19, 2012 | 2:31 am

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?


January 19, 2012 | 2:56 am

take a look at [combine].


January 19, 2012 | 3:15 am

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?


January 19, 2012 | 4:45 am

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


January 19, 2012 | 11:12 am

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.


January 19, 2012 | 2:22 pm

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?


January 19, 2012 | 8:55 pm

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

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


Viewing 8 posts - 1 through 8 (of 8 total)