Try this:
Code:
alias mcodes {
  var %a
  !.echo -q $regsub($1,/([]|(?:\d\d?(?:\x2C\d\d?)?)?)(?=(?:[]|(?:\d\d?(?:\x2C\d\d?)?)?)*?\1)/g,,%a)
  return %a
}

Fex, //echo -a $mcodes($e1(blah) $+ $e2(bleh))

It works for all control codes (not just Ctrl+K)

Edit: fixed a typo in the regex

Last edited by qwerty; 29/03/03 04:02 AM.