Adding a line break to {"value": "Hello there, welcome"} in the formula composer 🧐

image
Do you guys know how to add a line break after “Hello there!”?

Hi,

Does this formula help?

REPLACE_ONE_REGEX("Hello there! Just to note...", "Hello there!", "Hello there!\n")

Thanks, I see where you’re going now. But "Hey there!/n" will display Hey there!/n

And my alternative "Hey there!\"/n\"" shows Hey there!“/n”. The composer syntax is confusing…

But "Hey there!/n" will display Hey there!/n

Does it? I have tried this on a Text component, and it works fine, displaying “Just to note…” from a newline.

And my alternative "Hey there!\"/n\"" shows Hey there!“/n” .

That happens since \ is an escape character. So \" allows you to add a quotation mark as a string, not part of the formula. See: Escaping Strings in JavaScript - Stack Overflow

image
From the gmail box.

Shall I change the content type to html?

"type": "text/html"

Oh, you should have given context for the text’s final destination! For emails, use <br> instead of \n to get a new line.

1 Like

For our readers, we therefore no longer need the regex formula since we use simple html tags.
So Javascript should be like:

"content": [
{"type": "text/html", 
"value": "<p>Hey there!</p> <p>Just a quick note to confirm your account creation.</p> <p>Thank you!</p>"}]

where you can use any html tags like <br>, <strong> etc…

2 Likes