toggleCASE by

#!ruby -p
gsub(/([A-Z])(.+?([A-Z]|$))/){$1+$2.swapcase}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top