How to replace multiple line breaks

I’m trying to replace multiple line breaks in a field with a double line break, but only when there are 3 or more in a row.

So for example I would want to replace


with
\

and



with

etc.

I’m trying this but it doesn’t seem to work


UPDATE xf_post SET message = REPLACE(message, '\
\
\
', '\
\
')

Are you sure you just have
as a new line not \r
?