You didn't share your method body, but I suspect you're trying to echo the incoming message back into the room. The exception you see is not due to the incoming format but the outgoing format.
When sending messages, all special characters have to be escaped, as you have found. You can review the docs at this page:
https://docs.developers.symphony.com/building-bots-on-symphony/messages/overview-of-messageml#xml-formatting
My bad - I didn't realise you were using a regex in your pattern - that is no longer supported since 2.5.0 when arguments were introduced. there was also a fix for escape sequences in the interim but you should look at upgrading to the latest version of BDK. if you require a custom matcher (including regex), you will need to build a custom class that extends CommandActivity<CommandContext>
and define an override to matcher()