wouldn't using $strip() do what you are after?
from the help file (/help $strip):
$strip(text,burcmo)
Returns text with all bold, underline, reverse, and color control codes stripped out.
The burcmo parameter is optional, if used, it strips only the specified types of characters.
The m applies the strip settings in the Messages dialog, and the o applies the "only if..." settings in the messages dialog.