Forums > MaxMSP

regexp multiple substitutions?

January 29, 2013 | 11:56 pm
– Pasted Max Patch, click to expand. –

basically combining this into one. this seems wasteful

it also doesn’t work as I want it to.


January 30, 2013 | 12:23 pm

this is highly frustrating… Does ANYONE know how can I do that?

I just want this: detect Item1 Item2 Item3 >>> replace Item1 with X; replace Item2 with Z, replace item3 with Y.

I don’t want to break-up the list


January 30, 2013 | 2:12 pm

If the items are consecutive you can do it like this.

– Pasted Max Patch, click to expand. –

January 30, 2013 | 3:04 pm

I have a variable list size, so brute force isn’t feasible.

I just thought since regular expression in perl/java does allow multiple substitutions that there is a way to do it in max.

edit: theres a problem this way,

if the input is all x’s, the output wont go through the next regexp. Actually if there is anything but all characters present then it wont go through.


January 30, 2013 | 3:31 pm

I actually had all the outlets connected and it didn’t occur to me to connect the "no match" to the next input. I need my head checked.

Thanks a lot for your help!


January 30, 2013 | 4:33 pm

Are you sure you need regexp for that? A simple coll can do the trick

– Pasted Max Patch, click to expand. –

January 30, 2013 | 11:32 pm

My first attempt was with iter, with triggers instead of coll though.
For lists i feel regexp to be cleaner.

Where’d you get 6.1??


January 31, 2013 | 1:54 pm

IMHO regexp is for "withing string manipulation", here you just need to replace items in a list.

for the second question… that’s a secret ;-)


January 31, 2013 | 7:13 pm

True, i just for some reason try to avoid breaking up lists with iter and recombining them. I feel like it could fall out of sync – i know its completely stupid and I’m just paranoid, but still. :)

I want to be a beta tester too :) let me in!


February 2, 2013 | 11:11 am

Ah, okay. I’ll go with triggers then :)


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