I’m brand new to Knime and learning my way around it, so please forgive me for posing such a basic question. I’ve been trying to use the String Manipulation node to remove some extraneous text from a column. As you can see below, if the string is empty it was replaced by an “N/A” however in many cases “N/A” is included at the end of the appended list. It doesn’t seem that I can correct this issue at source, so I’d like to find and delete the ‘, N/A’ string but only if has been appended to one of the non-empty strings. For the life of me I haven’t found a way to make it work yet.
One approach to this problem is to use RegEx to replace all the “, N/A” with nothing. Use the String Manipulation node with the following expression: regexReplace($ColumnName$,", N\/A","" )
Thank you elsamuel! That worked a treat. If you don’t mind my asking one more question, what’s the difference in the search functionality between ‘RegEx Replace’ and standard ‘Replace’? I know that RegEx stands for Regular Expression but I’m not sure how the function really differs.
In this case, the Replace function would’ve worked.
I ended up with RegEx Replace because it allowed me to use a more complicated search pattern, which initially included a look-behind that matched only strings that had more than one word.
In the end I realized I could just include the comma in the search pattern instead of using complicated RegEx, but I didn’t remember to also switch the replace function to the simpler one.