Skip to main content
Question

Remove newline space

  • March 27, 2019
  • 6 replies
  • 1047 views

jugoslaviaa
Enthusiast
Forum|alt.badge.img+6

Hi all,

In the attribute of my data, there is sometimes newlines and I want to trim them. I am using the AttributeTrimmer however it is not working.

The data looks like this:

{33}SCHOOL, BUS ONLY 8-10AM 12-4PM EXC SAT-SUN-HOL SEPT

 

 

THRU JUNE,

I want to trim it like this:

{33}SCHOOL, BUS ONLY 8-10AM 12-4PM EXC SAT-SUN-HOL SEPT THRU JUNE,

 

Is my setting not correct?

Best

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

david_r
Celebrity
  • March 27, 2019

You'll need to use the StringReplacer for this.

The AttributeTrimmer only checks the start and end of the attribute value, so the newline embedded somewhere in the middle won't be removed.


jugoslaviaa
Enthusiast
Forum|alt.badge.img+6
  • Author
  • Enthusiast
  • March 27, 2019

You'll need to use the StringReplacer for this.

The AttributeTrimmer only checks the start and end of the attribute value, so the newline embedded somewhere in the middle won't be removed.

What should be the text to replace? I tried \\n and it did not work out.


jugoslaviaa
Enthusiast
Forum|alt.badge.img+6
  • Author
  • Enthusiast
  • March 27, 2019

You'll need to use the StringReplacer for this.

The AttributeTrimmer only checks the start and end of the attribute value, so the newline embedded somewhere in the middle won't be removed.

Thank you! It worked with /v :)


david_r
Celebrity
  • March 27, 2019

Thank you! It worked with /v :)

Excellent. You can also simply open the Text Editor window and manually enter a newline on its own.


nmartin
Participant
  • Participant
  • June 18, 2020

Excellent. You can also simply open the Text Editor window and manually enter a newline on its own.

So I didn't scroll down to this response and was tearing my hair out for 10 minutes trying /v \\r\\n \\n etc.

 

I eventually found https://knowledge.safe.com/questions/48695/how-to-split-a-delimited-string-with-a-carriage-re.html which is a related issue where the answers there were the same as you gave here.

Obvious only in hindsight, as I never would have expected I would need to go into the text editor than just use the text box provided in the StringReplacer


r_huesken
Contributor
Forum|alt.badge.img+5
  • Contributor
  • March 2, 2023

Thank you! It worked with /v :)

Just a tip for anybody who is trying to split a multiline text attribute using an AttributeSplitter:

  1. Use the text Editor to specify the newline: type <enter so your first line is empty, then close the text editor. So obvious one might overlook this option.
  2. Expose the list attribute list that is created after the AttributeSplitter image