Adding newlines with find and replace

Is there a way to encode a newline into the TBX editor’s find and replace text field? I.e., if I wanted to add a newline after every occurrence of “foo”? Or do I have to resort to action code to do this?

\n is the normal line end/break marker. This works for me:

$Text = $Text.replace("\n","\n\n");

Note that you need to explicitly pass the result of $Text.replace() back as the new value of $Text. Just calling the replace function alone won’t affect the existing test.

If you wanted to only double space after paragraphs ending ‘foo’, then use:

$Text = $Text.replace("foo\n","foo\n\n");

Hi Mark — thanks for the reply.

Can you do this with the find-and-replace dialog box? I’m talking about this thing:

(testing in v7.5.0b318) It seems not. For a task of this type using ‘invisible’ characters, I’d generally use a stamp (or other action context) as per my previous answer.

Still, I take the point. I think you may be about to make a feature suggestion!

1 Like

Yep, type alt-return in the replace field to insert a newline.

1 Like

Ah, you mean like with basically every other text field in the entire application?

:man_facepalming:

Thanks.

1 Like