Just wondering, what's the difference between var %x = $1- and set -ln %x $1- ? Actually, why the -n switch? I can't get a difference with or without the -n switch...

I didn't know about ! being a no-op command, that's one I'll be using a lot smile Mostly in the exact same context too: regex :tongue:
Apparently !! works too, but !!! gives the /! no such command error crazy

I had to think twice before I got the need for the while loop, but you can do without (yes, I finally found a use for (?R) :tongue: ) Fails if the braces are not matched...

alias rem {
set -ln %x $1
$null($regsub(%x,/\{(?:[^{}]|(?R))*?\}/g,,%x))
return %x
}