File Content Replacer Multi Line Replacement Text

Hi,

I am trying to use the File Content Replacer, with replacement text that contains a newline.

If I use control characters (\r\n), they are not treated as control characters, but I also cannot include a newline in the text, because the dialog is not a multi-line text box, so it is ignored.

How do I get the file content replacer to accept multi-line replacement text ?

 

Thanks.

 

0
5 comments

Hi,

 

may I ask you to write explicitly what you are putting onto the fields? At the very least a working example even if it's not the same text.

 

Please remember that this is going to be as a java replacement that then will be pushed into the file, so if you put "\r\n" it will be passed to the resulting file as "rn" instead, and that cannot be treated as control characters, you would need to escape the "\"s as well. This is already mentioned on the tooltip.

0
Avatar
Permanently deleted user

Thanks Denis,

I tried several variations. Maybe I needed to use "\\r\\n" ? As I couldn't get it to work I used a regex in a powershell build step instead.

0

Hi,

 

I think this issue stems from the replace with field not allowing multiple lines, which I think is just an oversight. It works if you either:

-Use versioned settings and add the newline symbols in there.

-Create a build parameter with whatever you want in the replacement field. This parameters do support multiple lines just fine and catching groups will be picked up just fine anyway.

 

I've passed this internally for review anyway, but that should ease the task on your end. Could you see whether that works for you?

0
Avatar
Permanently deleted user

Thanks Denis,

The powershell workaround is working for us. I will try your alternatives if I need to do similar in future.

0

Hi,

 

just to follow up, and for anybody else coming here with the same question, I reported this internally and we created this issue in our tracker: https://youtrack.jetbrains.com/issues/TW-61638

 

It was taken up as a bug and it should be fixed already for the next release (2019.1.3)

0

Please sign in to leave a comment.