Another way to get rid of the excess ! and ? while removing spaces in front of them is to use the substitution $regsub($1-,/ ?([?!])(?: ?\1)*/g,\1,%var)

Also Dave you missed a $ in !ctrlenter at the top. Might also want to check it's not a command (/* !iswm $1)