There are several string functions in MRL that might solve your problem, however I would need to see a few examples of the whole string in order to suggest a solution I know would work.
Based on the information you have provided, I would look at the strreplace function. It searches for one or more sub-strings within a larger string and replaces each occurrence with a new string. For example:
$EV.msg = strreplace($EV.msg,' ',' ');
would replace every occurrence of two consecutive spaces in the msg slot of your event with a single space.
See the documentation for a detailed explanation of the syntax and some more examples.
I will see if that will work but it may not be supported as we are still on BPPM 9.6 and that function is not listed in that documentation.