It’s ok, I worked out how to do it with regsub — {ADT^A31} $my_msg {ADT^A28} my_msg.
The reason I’m doing it is that I want to change the message type and resend it if I get a particular error message the first time. I’m modifying one of the recovery procs, validate_reply_38 to achieve this.