regexp multiple substitutions?

Ploki's icon
Max Patch
Copy patch and select New From Clipboard in Max.

basically combining this into one. this seems wasteful

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

Ploki's icon

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

broc's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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

Ploki's icon

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.

Ploki's icon

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!

Emmanuel Jourdan's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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

Ploki's icon

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??

Emmanuel Jourdan's icon

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 ;-)

Ploki's icon

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!

Ploki's icon

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