Multiple substitution with regexp?

bkshepard's icon

Is it possible to do multiple substitutions with regexp? For example, can you do something like: [regexp item1 item2 @substitute item3 item4] where item1 is replaced by item3, and item2 is replace by item4? I've been doing it by just stringing two regexp objects together, but wondered if there might be a more elegant solution. Thanks.

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

if they are just single atomized messages with arguments, then they are sent around as what regex interprets as "lines". and because regex is designed to handle lines of input, you can look at the first two "items" as a special case in which you have two words separated by a space, then two spaces:

jml's icon

"then two spaces:"

ignore this bit, it was a typo.

jml

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

Thanks, jml. This is what I'm attempting to do. In both cases, I'm actually looking to replace special characters.