Japt, 35 bytes
Port of Arnauld's JS solution.
r"%)%d?.|%(%w\{0,3}."Ȥ?XÅn36 d:XÌu
Try it Try it (includes all test cases)
r"..."Ȥ?XÅn36 d:XÌu :Implicit input of string
r :Replace
"..." : RegEx /\)\d?.|\(\w{0,3}./g
È : Pass each match, X, through the following fuction
¤ : Slice off the first 2 characters
? : If truthy (non-empty string)
XÅ : Slice off the first character
n36 : Convert from base 36
d : Get character at that codepoint
: : Else
XÌ : Last character
u : Uppercase
Japt, 35 bytes
Port of Arnauld's JS solution.
r"%)%d?.|%(%w\{0,3}."Ȥ?XÅn36 d:XÌu
Try it (includes all test cases)
r"..."Ȥ?XÅn36 d:XÌu :Implicit input of string
r :Replace
"..." : RegEx /\)\d?.|\(\w{0,3}./g
È : Pass each match, X, through the following fuction
¤ : Slice off the first 2 characters
? : If truthy (non-empty string)
XÅ : Slice off the first character
n36 : Convert from base 36
d : Get character at that codepoint
: : Else
XÌ : Last character
u : Uppercase