Remove dash from string

Greetings community!
New to knime, I’m sorry if it’s a trivial question. I have a table with strings texts such as “out-of-home work schedule - meaning work relation”. I want to remove the dash preceded and followed by white spaces, but not the ones connecting the words. I tried string manipulation but I cannot find the right expression. Any sugestion?

1 Like

Hi @Quendi and welcome to the KNIME community !

Maybe a -string manipulation- node could do the job with the following setting:

replace( $your_column_name$, " - ", " ")

Please notice that " - " means “blank-blank” :slight_smile:

On top of this, maybe you would like to remove any repeated blank for which I would add the following:

removeDuplicates( strip( replace( $your_column_name$, " - ", " ")))

"removeDuplicates(...)" Replaces all occurrences of two or more spaces with a single space character.

"strip(...)" Strips any whitespace characters from the beginning and end of given strings.

Hope it helps :wink:




Thank you kind Sir, it worked.

1 Like

My pleasure to help kind Sir !
Best wishes

1 Like