Escape codes for StringReplace?

Hi all,

I have some text data in a column that contains embedded line endings. Multiple occasions in each row.

I'm trying to get rid of them using the String Replace node, but I can't work out how to escape control codes.

I could add a JPython snippet to do this, but I'm sure somebody out there will tell me how to do this easily with String Replace.

What I have:
"The quick brown fox
jumps over
the lazy dog."

What I want:
"The quick brown fox jumps over the lazy dog."


Hi Simon,

unfortunately the String Replacer doesn't allow you to enter any control codes.

In your case it would be a simple task for the Java Snippet node:
In the Dialog of the node, set the Return Type (lower right) to "String", select whether you wish to replace your column or a append a new one (lower left).

Then enter Java code in the editor field:
First, select the column from the left that contains the line with the line endings to replace (lets assume it's called "Text").
This will insert $Text$ in the code area. Add .replace('\n', ' ') to replace each \n (line ending) in the data of one cell in column "Text" with a space.
Your code should look like this:
$Text$.replace('\n', ' ')

That's all.
Let me know if you have problems with it.
- Peter.

Thanks Peter.