Replace newline for message fail

Hi all,

There are some message content in message field as below:

HoldMoney = 0,\n    MaxLossMoney = 0,\n    OddsMoney = 0,\n

I tried to replace the “\n” to the “space”, so I wrote the rule as below:

rule "remove newline"
when
    has_field("message")
then
    let new_message = regex_replace("\\n", to_string($message.message), " ", true);
    set_field("message", new_message);
end

but it doesn’t work, any idea ?

Poking around I cam across this post - maybe it will help? IT talks about replacing the \n and \r separately… even though you haven’t mentioned the \r

@tmacgbay thanks a lot!!I’ll try it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.