Code:
alias test { 
  var %s $+($1,\)
  return $regsubex(%s,/^(.*)\\$/,\1) 
}


//echo -a $test("")
This will return ""

Let me know if it doesn't work as you intend it to.