How can I replace a newline (in a plain text field) with a comma? I need to convert a new line in a plain multiline text field in Craft into a comma.
My text looks like:
1 Infinite Loop
Cupertino, CA

and I want to convert it to: 1 Infinite Loop, Cupertino, CA
I tried doing {{ text|nl2br|replace({ '&lt;br&gt;', ', ' })|raw }} but that didn't work.
I figured out that the best way to do this was to replace the newline character \n.
Final code:
{{ plainText|replace({ &quot;\n&quot; : &quot;, &quot;}) }}