$TABLE='a'; #or whatever the default set is s/(?:\x1B([abcs])(?{$TABLE=$^N}))?(.)/${$TABLE}{$2}/e