Inserting a new line in text by string replacer

Hi,

I am not so familiar with REGEX and would appreciate a little help. In a string cell with text like

1. text. 2. othertext. 3. justanothertext...and so on

I want to insert a newline/carriage return just before the numbers with the StringReplacer to get the following result:

1. text.

2. othertext.

3. justanothertext...and so on

I use ( )([0-9]{1,3}\. ) for the text to replace which seems to work and \n$2 for the replacement text. It inserts the numbers again but not the new line. Instead I get a 'n1.' for example.

Any ideas? Thanks in advance, Jerry

 

 

 

How about \r\n$2

simon.

Thanks Simon,

I get rn1. as replaced text. The String Replacer does not seem to recognize special characters like \r or \n and when I choose 'Regular expression' the 'use backslash as escape character' is dimmed. 

Best regards

Jerry

Hmm, I've tried absolutely everything to get this to work, but cant.

Sounds like a bug, or RegEx isnt implemented in the replace string box?

Simon.

Thanks for trying

Jerry

A bit tricky, but I hope the attached workflow gives a workaround for your problem.

Cheers, gabor

The replacement text doesn't recognize special escape sequences (only backreferences). Therefore you cannot insert newlines or tabs, for example.

Thanks a lot, Gabor

The workaround works excellent.

Kind regards, Jerry

 

 

Was wondering if anyone has gotten this to work with tabs?

Using aborgs workflow, and changing \n to \t doesn't seem to be working.