Backport improved transformation parsing function

Should work with (I believe) with all formats of \t.
Fixed cases include \t(\tag), \t(1.3,\tag) and \t(123,0,\tag)

Also, completely untested. Have fun.