Search code examples
regexmulesoft

How to replace following OBJECT(o) with space from payload using expression component in Mule?


How to replace following OBJECT(o) with space from payload using expression component in Mule? I have tried to use the following expression but it does not work.

<expression-transformer expression="#[payload.replaceAll('OBJECT(o)', ' ')]" doc:name="Expression"/>


Solution

  • You need to use replace (see Mulesoft docs). Note the escape character ('\') before the internal parentheses.

    payload replace /(OBJECT\(o\))/ with " "