How to split message by another character sequence rathen than space?

Apr 30, 2012 at 5:29pm

How to split message by another character sequence rathen than space?

I know that if I have a message like “some random text” I can use zl iter to give me first “some”, then “random” and then “text”.

I wish to do the exact same thing but with another character rather than the ” ” (space). Is it possible, how?

Ideally I would be able to do it with a character sequence, “|||”, for instance.

Thanks.

#63317
Apr 30, 2012 at 5:58pm

Like this?

– Pasted Max Patch, click to expand. –
#228383
Apr 30, 2012 at 6:26pm

Thanks for your reply.

I am getting a message in the Max window (a warning, I suppose, since it’s in yellow) which reads: “#N: extra arguments for message “fromsymbol”". The output printed is the same as the list, so it didn’t worked as supposed.

Any idea, why? Thanks.

#228384
Apr 30, 2012 at 11:03pm

No idea. What I posted works for me in Max 5 and Max 6. You aren’t using Max 4 by any chance are you? And you didn’t change anything (like maybe a space somewhere)? If you want to post what you have that’s malfunctioning, I’ll try it on my computer.

#228385
May 1, 2012 at 12:29am

I am using Max 5. That’s strange then. Anyway, I have found another way to overcome what I initially was trying to accomplish. Thanks anyway.

#228386
Sep 19, 2012 at 5:56pm

@nuno could you then please share your discoveries ? i have a similar problem .

i have a list that contain path’s with additional data . how to provide such splitting and keep the path formatting (in quotes) as in original ? i know that [tosymbol] and [fromsymbol] are messing all the data in my example ,its just for presentation .

– Pasted Max Patch, click to expand. –

Im in need to get those lists separately . I could not find any common solution . as u can see there is a special need for keeping the path formatting ,and those lists contain variety amount of elements .
Ive also tried to use [regexp] in different logic but somehow it cuts the “zeros” from the lists . like 06 becomes 6 :/

i hope to hear from you guys

#228387
Sep 20, 2012 at 6:21am

Hi,

– Pasted Max Patch, click to expand. –
#228388
Sep 20, 2012 at 11:15am

Hello Nicolas !
Thank you for the input ,

but please take a look :
everything is as should be while you print the results !
but if you want to use that data ,you are still getting these “backslash escapes” wrapped around the quotes . Looking at your second regexp i can tell that it should do the job . but its not ?

– Pasted Max Patch, click to expand. –
#228389
Sep 20, 2012 at 1:51pm

Hi,

HTH, (maybe be improved by regular expression guru) :

– Pasted Max Patch, click to expand. –
#228390
Sep 20, 2012 at 3:58pm

it works . wonderful !
thank you very much for your huge help and time Nicolas , it seems to be a bit more tricky than i thought .

#228391
Sep 20, 2012 at 4:21pm

Hi,

Yep, can be tricky in MaxMSP (and computing in general) to deal with special characters like space, backslash, quotes and so on. Hell for people in the world with é ñ á á Å ø ß ŝ Ħ Ă ! So_the_best_is_to_avoid_them asSoonAsYouCan.

#228392
Sep 20, 2012 at 5:13pm

and with comma’s :/ … Nicolas ? did you provided those expressions from head directly ? if so , im amazed … im not going to learn it, i guess . im glad that you came across

#228393
Sep 21, 2012 at 3:28pm

i found Luke Hall’s regular expression tutorials ( nice effort from Luke – thanks! ). if someone need to dig in

http://cycling74.com/toolbox/regular-expression-tutorial/

#228394

You must be logged in to reply to this topic.