Question

Replace Unix line breaks (\n) with DOS (Windows) line breaks (\r\n) using Nintex

  • 10 January 2024
  • 2 replies
  • 81 views

Badge +3

I am migrating a workflow from Nintex for SharePoint 2013 to NAC.  One for the requirements is that I be able to replace the Unix line break character (\n) with DOS line breaks (\r\n) in the text before creating the .csv file.  In SharePoint 2013 I was able to do this using a regular expression action which replaced “\n” with the function “Common:Newline” which replaced them with DOS carriage return.  This function is not available in NAC and when I try to use the NAC regular expression replace action, it is able to find the Unix carriage returns with the pattern “\n” but it replaces them with the actual text “\r\n” instead of the special character.  I have seen several solutions about using variables as the replacement for spaces but nothing on creating a variable for a special character like a DOS carriage return.  Has anyone had to do something like this that can offer a workaround? 


2 replies

Userlevel 4
Badge +10

Yeah, I don’t like the decisions NAC makes when it comes to these kinds of characters.  I had a similar problem here, but I don’t think that’ll help in your situation: 

 

Whenever I try to get a variable to contain a “\r\n” combination, NAC always converts it to <br> for some reason… That probably accomplishes what’s necessary for an email, but certainly not for your CSV. 

Badge +3

At this point I have a work around in place for the system that I was sending the file to where I have to create individual files to send each request.  And luckily the Unix line breaks don’t appear to be an issue for the other systems that I am creating CSV files for like this.  Just disconcerting that the replacement field in the regex action is interpreted as literal text instead of allowing character patterns.  

Reply