So the first part of the string typed into the “send” field would need to be processed by a program with about the sophistication of sed - Wikipedia , not sent raw?
This sounds like something best done with a client-side draft-editing app (the sort of program that could also auto-replace all instances of “teh” with “the” before sending).