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.
Do any of you kind folks have any ideas? And if this question has already been answered somewhere please point me to it! I’m running Knime 4.5.1.
Welcome to the forum, @CKillick.
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.
Ok. I think I understand. Thanks again!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.