s/$/"/ : s/(\(.*"\)/<\1/ s/)\(.*"\)/>\1/ t :a s/\(<[^>]*\)<\([^<>]*\)>/\1(\2)/ ta s/<\([^>]*\)>S\(.*".*\)/\2\1/ s/<\([^>]*\)>^/\1/ s/\(<[^>]*>\)\(<[^>]*>\)~/\2\1/ s/\(<[^>]*\)><\([^>]*>\)\*/\1\2/ s/<[^>]*>!// s/\(<[^>]*>\):/\1\1/ s/\(<[^>]*>\)a/(\1)/ t s/.*"//
Note that non-ascii characters in the above source code will be escaped (such as \x9f).