As per my testing, the CTL2 code can handle the N/A text unchanged. However, I have at least used brackets to separate the text from the carriage return. Also, as you may have Carriage Returns but not Line Feeds in your input data, vice versa, or both, you can use the following expression, which will match any combination of those characters: [\r\n]. (The square brackets stands for OR operator). Then the desired CTL2 code would look as follows:
Code: Select all
replaced_text = $in.0.Field1;
replaced_text = replace(replaced_text,"(N/A)([\r\n])", "\"\"");
$out.0.Field1 = replaced_text;
Please give it a try and let me know if it works. If it doesn't work as you expected, could you please provide me with your input data so that I can take another look? Thanks and have a nice day, Eva.